Manali - Tuesday, July 15, 2014 5:39 AM:
I have child item number and i want to find out its parent item number.
Thanks,
Manali
zahar - Tuesday, July 15, 2014 5:54 AM:
<AML>
<Item type="Part" action="get">
<Relationships>
<Item type="Part BOM" action="get">
<related_id>
<Item type="Part" action="get">
<item_number>XXXXXX</item_number>
</Item>
</related_id>
</Item>
</Relationships>
</Item>
</AML>
eknath - Thursday, March 24, 2016 4:57 AM:
Hi Zahar, How can i get parent item from child item using c sharp method.zahar - Thursday, March 24, 2016 7:18 AM:
I assume that:
- you are running this code from Aras method
- you are talking about Part BOM relationship between 2 parts
Your code will be like this:
Item qry = this.getInnovator().newItem("Part", "get");
Item bomRelItm = qry.createRelationship("Part BOM", "get");
Item childItem = bomRelItm.createRelatedItem("Part", "get");
childItem.setProperty("item_number", "xxxxxxx");
qry = qry.apply();
if (!qry.isError()) {
for (int i = 0; i < qry.getItemCount(); i++) {
Item parentItem =qry.getItemByIndex(i);
}
}
Lines 1-5 you can replace with
Item qry = this.getInnovator().applyAML(MYXMLFROMPREVIOUSANSWER);