OR Condition for Relationship

Hi

How to convert the below OR condition AML for relationship to IOM.

<AML>

<Item action ='get' type='Part'>

<Relationships>

<OR>

<AND>

<Item action ='get' type='Part Document'></Item>

</AND>

<AND>

<Item action ='get' type='Part BOM'></Item>

</AND>

</OR>

</Relationships>

</Item>

</AML>

Below option I tried, but getting not a single item error.

Item partItem = this.NewItem("Part", "get");
Item partBom = this.NewItem("Part BOM", "get");
Item partDoc = this.NewItem("Part Document","get");
Item logicalAND = partItem.newAND();
Item logicalOR = logicalAND.newOR();
logicalOR.addRelationship(partBom);
logicalOR.addRelationship(partDoc);
partItem = partItem.apply();

Thanks

Parents
  • Hello,

    I was able to reproduce this issue in my environment. It seems that logical operators cannot have relationship added to them through the API. I've run into trouble a few times in the past trying to use logical operators in the API, and I've found it's easier to just build the AML string directly and then apply it with this.getInnovator().applyAML(myAmlString);.

    It could also be possible to rewrite this AML to not use logical operators at all. Could you clarify what data you're trying to return with this query?

    Chris

    Christopher Gillis

    Aras Labs Software Engineer

Reply
  • Hello,

    I was able to reproduce this issue in my environment. It seems that logical operators cannot have relationship added to them through the API. I've run into trouble a few times in the past trying to use logical operators in the API, and I've found it's easier to just build the AML string directly and then apply it with this.getInnovator().applyAML(myAmlString);.

    It could also be possible to rewrite this AML to not use logical operators at all. Could you clarify what data you're trying to return with this query?

    Chris

    Christopher Gillis

    Aras Labs Software Engineer

Children