Forum Discussion

AngelaIp's avatar
AngelaIp
Ideator I
6 months ago
Solved

What does the "isCriteria" attribute do?

Hi Community, what is the purpose of the "isCriteria" attribute? It´s described in the programmers guide like this: "If 0 then include the nested structure for the Item configuration in the respo...
  • christopher_gillis's avatar
    6 months ago

    Hi Angela,

    This is one of those niche attributes which likely is very useful but only in specific circumstances.

    This is intended to be used when you are expanding on Item properties or relationships where you want to expand on some data if it exists, but you don't want to limit your results if it doesn't.

    As an example of an AML query that does change when you use this attribute, we can look at this query where we are trying to get all of our PRs with a specific affected Item. 

    <AML>
        <Item type="PR" action="get">
            <affected_item>
                <Item type="Part" action="get">
                    <item_number>Part-123</item_number>
                </Item>
            </affected_item>
        </Item>
    </AML>

    In the above example, we would get only the PRs with specifically Part-123 as the affected item. If we instead change this query to use the `isCriteria` attribute:

    <AML>
        <Item type="PR" action="get">
            <affected_item>
                <Item type="Part" action="get" isCriteria="0">
                    <item_number>Part-123</item_number>
                </Item>
            </affected_item>
        </Item>
    </AML>

    We will get all of the PRs in our database whether or not the affected item is Part-123. The only difference is that the affected_item property in this example will be expanded for specifically those PRs that do have Part-123 as its affected item. 

    Hope this helps!

    Chris