AML request get where relationship is empty

Hi all, I'm struggling with an AML request, i would like to get items from an Item Type where a certain Relationship is Empty, and an other request  where this Relationship is not empty. Thank you ! Léo
  • Hello Leo, If your relationship is related (related_id != null): To get items without relationships:
     <AML>
       <Item type='Part' action='get'>
         <Relationships>
         <Item type='Part BOM'>
           <related_id condition='is null' />
         </Item>  
         </Relationships>
       </Item>
     </AML>
    To get items with relationships:
     <AML>
       <Item type='Part' action='get'>
         <Relationships>
         <Item type='Part BOM'>
           <related_id condition='is not null' />
         </Item>  
         </Relationships>
       </Item>
     </AML>
  • Hi Zahar, Thank you for your answer, however i haven't been able to make your AML resquest works as intended,  it always return all the items wheter or not the item's Relationship is empty or not (is null and is not null yield the same result). Even using your exact code on Part and BOM. Could you tell me if it works on your end, i havent been able to figure out what's wrong on my end. Thank you again ! Léo
  • Leo, Sorry I have one error in AML (for "To get items with relationships"), you need to add action='get' to the Part BOM item tag:
     <AML>
       <Item type='Part' action='get'>
         <Relationships>
         <Item type='Part BOM' action='get'>
           <related_id condition='is not null' />
         </Item>  
         </Relationships>
       </Item>
     </AML>
    For the second case you can do it using following AML:
      <AML>
        <Item type='Part' action='get' where="[Part].id not in (select source_id from Part_BOM)" />
      </AML>
    
    Keep in mind that starting Aras 11SP9 where attribute of this type is not secured and in the future version will be obsoleted. Till then if you are using Aras 11SP9 you need to add following XML tag to your InnovatorServerConfig.xml
    <operating_parameter key="parse_item" value="false"/>
    
  • Hi Zahar, Thank you very much for your detailed answer ! Léo
  • Hi Leo. I`m struggeling with a similar request. Did you get this solution to work for you? If i use the above solution i still get a search that returns no hits when searching for empty relationships.

    One problem i see is that we want to find items that are missing specific relationships, i.e. the relationship is not there. As i see the above logic, it searches on the relationship properties, but this relationship is not there in the first place.