Forum Discussion

PLMNewbie's avatar
PLMNewbie
New Member
3 hours ago

AML Relationship traversal — filtering items from the related side

I have a relationship between two item types structured as:

ItemTypeA (source) → RelationshipType → ItemTypeB (related)

When querying from the source side it works correctly:

<Item type="ItemTypeA" action="get">
  <Relationships>
    <Item type="RelationshipType" action="get" select="related_id"/>
  </Relationships>
</Item>

But when I try to filter ItemTypeB by a property on ItemTypeA using the Relationships block, it returns zero results:

<Item type="ItemTypeB" action="get">
  <Relationships>
    <Item type="RelationshipType" action="get">
      <source_id>
        <Item type="ItemTypeA" action="get">
          <some_property condition="like">value%</some_property>
        </Item>
      </source_id>
    </Item>
  </Relationships>
</Item>

Using a SQL subquery in the where attribute is also not an option as Aras explicitly blocks it with:

<Item type="ItemTypeB" action="get"
  where="ItemTypeB.id IN (SELECT related_id FROM RelationshipType WHERE source_id IN (SELECT id FROM ItemTypeA WHERE some_property LIKE 'value%'))">
</Item>

Error:ItemAnalysisException

SELECT is forbidden in whereattribute

Question: Is there any supported AML syntax to filter items from the related side of a relationship without a separate pre-query? Or is a two-call approach the only supported option?

No RepliesBe the first to reply