Simple method help

rated by 0 users
This post has 3 Replies | 3 Followers

Top 25 Contributor
Posts 46
Points 635
scottmahr Posted: Mon, Aug 30 2010 6:55 PM

I thought I was getting the hang of this stuff, then this didn't work.  My eventual goal is to look at many quotes (an itemtype I created) that are linked to a part, select the cheapest one, and fill in a field "quoted_value" in the goal itemtype with that price.  Currently I am just trying to create a goal attached to a part, but it is not working, any help would be greatly appreciated.

What I have so far.

 

Item partGoal = this.createRelationship("Part Goal", "add");

partGoal.setProperty("goal", "cost");

partGoal.setProperty("quoted_value", "123");

Item resultItem = this.apply();

return resultItem; 

 

What makes this more frusterating is that I can get it work using a C# program running on my desktop, and with AML through the NASH interface, but somehow this doesn't work.  I think it is because I do not quote understand what "this" refers to in actions.

 

Scott

  • Filed under:
  • | Post Points: 35
Top 10 Contributor
Posts 389
Points 5,785

Scott,

If you have AML that works through NASH why not just use the same AML here?

Innovator inn = this.newInnovator();

Item partGoal = this.newItem("");

string myAML = "whatever AML you have that works";

partGoal.loadAML(myAML);

Item resultItem = partGoal.apply();

if (resultItem.isError() )

{

     return inn.newError(resultItem.getErrorString() );

}

return resultItem;

Cheers,

Brian.

  • | Post Points: 20
Top 25 Contributor
Posts 46
Points 635
scottmahr replied on Fri, Sep 17 2010 12:40 PM

Brian, Thanks for the advice.  I had some luck figuring out how to make it work in a similar way to what I had.  I will keep the idea of using raw AML in the future though.

 

Scott

  • | Post Points: 5
Top 25 Contributor
Posts 51
Points 675

Hi Scott,

It is good you got other way to solve your problem.

But this is suggestion for C# that whenever you are making some changes related to DB.

Return you result with :--  return innovator.newResult(res);

-- Vishal

  • | Post Points: 5
Page 1 of 1 (4 items) | RSS