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 - Help with First method

dalewill - Tuesday, August 6, 2013 2:50 PM:

Everyone:

I'm working on my first method.  A small piece of code to return a top assembly part #.

Item qryItem = this.newItem("A_CN", "get");
qryItem.setAttribute("select", "top_assy_pn");
qryItem.setProperty("id", "XXXXXXXXXXXXXXX");
Item results = qryItem.apply();

string pn = results.getProperty("top_assy_pn");
results.setProperty("tap", pn);

When I 'Run Server Method', the return data is:

<top_assy_pn keyed_name="11093-8" type="Part">6B44F561DD104C41AF08A73C7D3865A3</top_assy_pn> <tap>6B44F561DD104C41AF08A73C7D3865A3</tap> </Item>

The data is correct, what I want to get with the results.getProperty("top_assy_pn") statement is the keyed_name value of 11093-8, not the GUID.  I've tried several things with no luck.  How can I pull that keyed_name value out?

Sincerely,

Dale Williams

 



zahar - Tuesday, August 6, 2013 4:10 PM:

You can change your code to do what you expect:

tem qryItem = this.newItem("A_CN", "get");

qryItem.setAttribute("select", "top_assy_pn(keyed_name)");
qryItem.setProperty("id", "XXXXXXXXXXXXXXX");
Item results = qryItem.apply();

Item pn = results.getPropertyItem("top_assy_pn");
 string keyed_name = pn.getProperty("keyed_name");

results.setProperty("tap", keyed_name);



dalewill - Tuesday, August 6, 2013 4:17 PM:

Zahar:

    Thanks for the help.  That worked perfectly.

Sincerely,

Dale