guido.chiavaccini - Saturday, October 5, 2013 12:42 PM:
Hi all,
I'm trying to develop some server methods on Innovator 9.4 with IOM api... but I found a strange behavior in the IOM.
Some examples:
- The method "getRelationships()" applied to an Item does not return the Items under "Relationships" tag but the same Item on which I call that method.
- The method "getRelatedItem()" called on a Relationship Item does not return the Related Item but the same Item on which I call that method.
Maybe my code is wrong... or maybe there are serious bugs in the 9.4 IOM library... Is there someone with same experience?
Thanks.
Amit Nawale - Friday, November 29, 2013 4:55 AM:
Hi Guido,
Following code is working in my side.You can use this for reference.
Innovator inn=this.getInnovator();
string partAml=string.Format("<AML><Item type='Part' action='get' levels='1'><name>test</name></Item></AML>");
Item partItem=inn.applyAML(partAml);
if(partItem.isError()) return this;
Item relationshipItm=partItem.getRelationships();
// getRelationships() only return item that point to relationships of given Item.
// If that Item doesn't have relationship then It will not point to any Item.
// But item return by getRelationships() and parent Item have same xml.
// That means They share same xml and point to different node.
//So if you try to return both item then it will always give same result.
// if you want to check relationships then check getItemCount().
//It count is zero then it does not have relationships.
if(relationshipItm.getItemCount()>0)
{
for(int i=0;i<relationshipItm.getItemCount();i++)
{
Item relatedItm=relationshipItm.getItemByIndex(i).getRelatedItem();
//write your code
}
}
return this;
Thanks,
Amit