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 - getting Relationships(); Not a single Item

nx_plm - Tuesday, May 29, 2012 6:46 AM:

I have the following code:

            Item part = inn.newItem("Part", "get");
            Item result = part.apply();

            Item resultsBOM = result.getRelationships("Part BOM");

 

In "resultBOM", it gives an error which says "It is not a single Item" I have seen some code which works like as I wrote above.

Can anyone give me some clue?


Thank you



PeterSchroer - Tuesday, May 29, 2012 7:36 AM:

part.apply() returned a set of items,  "not a single item".  you need to iterate over the set,  or  quick short-cut for testing,  try:

Item resultsBOM = result.getItemByIndex(0).getRelationships("Part BOM")   

That grabs the first item in the set,  and fetches it's BOM relationships.