Reverse Relationship for Affected Items

I use the below script to query all the Affected Items, but this returns all the relationships and many nodes. <Item isNew="1" isTemp="1" type="ECN" action="get" id="{id}" select="config_id,item_number"> <Relationships> <Item isNew="1" isTemp="1" type="ECN Affected Item" action="get" select="related_id"> <related_id> <Item isNew="1" isTemp="1" type="Affected Item" action="get" select="new_item_id(config_id,item_number,name,generation,major_rev), affected_id(config_id,item_number,name,generation,major_rev)" /> </related_id> </Item> </Relationships> </Item>   But I would like to return only Documents linked to the given ECN id. Anyone can help to rewrite the query to return only the final "Document" item types.?
Parents
  • I think you could add one additional level under your "Affected Item" query. Both "new_item_id" and "affected_id" use the PolyItem "ChangeControlledItem". This PolyItems combines the ItemType "Part", "Document" and "CAD". In "ChangeControlItem" you can search for distinct ItemTypes, like "Document" by setting a filter on the property "itemtype". Different nomenclature, but something like this:
    Item ChCtrI = inn.newItem("Change Controlled Item","get");
    ChCtrI.setAttribute("select","id,item_number");
    ChCtrI.setProperty("id",new_item_id);
    ChCtrI.setProperty("itemtype", "Document");
    ChCtrI=ChCtrI.apply();
Reply
  • I think you could add one additional level under your "Affected Item" query. Both "new_item_id" and "affected_id" use the PolyItem "ChangeControlledItem". This PolyItems combines the ItemType "Part", "Document" and "CAD". In "ChangeControlItem" you can search for distinct ItemTypes, like "Document" by setting a filter on the property "itemtype". Different nomenclature, but something like this:
    Item ChCtrI = inn.newItem("Change Controlled Item","get");
    ChCtrI.setAttribute("select","id,item_number");
    ChCtrI.setProperty("id",new_item_id);
    ChCtrI.setProperty("itemtype", "Document");
    ChCtrI=ChCtrI.apply();
Children
No Data