This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Simple method help

scottmahr - Monday, August 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



Brian - Saturday, September 4, 2010 9:28 AM:

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.



vishal_trivedi - Monday, November 29, 2010 7:27 AM:

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



scottmahr - Friday, September 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