Forum Discussion
Hi Breton
It depends on the situation. If you want only the latest released item based on the Relation then use below query
Output of below query will be all the itemSource which is released and latest
<AML>
<Item action="get" type="Relation">
<source_id>
<Item action="get" type="itmSource" where="[itmSource].is_released = '1' AND [itmSource].is_current = '1'">
</Item>
</source_id>
</Item>
</AML>
Thank You
Gopikrishnan R
- Breton4 years agoIdeator III
Hello, Thanks for your answer but the AML respond is not compliant to the need :
why :
If you have- itmSource1 (generation=1, Is_released=1, is_current=0 ) linked to Relation1
- itmSource2 (generation=2, Is_released=0, is_current=1 ) linked to Relation2
Regarding the example, I would like to retrieve Relation1 (linked to itmSource1 at Is_released=1).
But is_current=0 because is not the latest generation
Normlaly, you can filter it by using queryType="Released", but not in sub AML request..(except I made an error) :-)- Gopikrishnan4 years agoAccelerator II
Hi Breton
Assuming below example: When you use only is_released = "1", it is always pointing to itmSource1 in the query
- itmSource1 (generation=1, Is_released=1, is_current=0 ) linked to Relation1 and you would like to retrieve Relation1 of this
<AML>
<Item action="get" type="Relation">
<source_id>
<Item action="get" type="itmSource" where="[itmSource].is_released ='1'">
</Item>
</source_id>
</Item>
</AML>Output of this query is
Relationship that connects itmSource in Released State or In Change State as source item and tmRelated as related item
- Gopikrishnan4 years agoAccelerator II
Assuming below example:
- itmSource1 (generation = 1, Is_released = 0, is_current = 0) linked to Relation 1
- itmSource1 (generation = 2, Is_released = 0, is_current = 0) linked to Relation 2
- itmSource1 (generation = 3, Is_released = 1, is_current = 0) linked to Relation 3
- itmSource1 (generation = 4, Is_released = 0, is_current = 1) linked to Relation 4Below Query Output is Relation 3
<AML>
<Item action="get" type="Part BOM">
<source_id>
<Item action="get" type="Part" orderBy="generation" where="[Part].is_released ='1' AND is_current ='0'">
</Item>
</source_id>
</Item>
</AML>Below Query Output is Relation 4
<AML>
<Item action="get" type="Part BOM">
<source_id>
<Item action="get" type="Part" orderBy="generation" where="[Part].is_released ='0' AND is_current ='1'">
</Item>
</source_id>
</Item>
</AML>Below Query Output is Relation 1 and Relation 2
<AML>
<Item action="get" type="Part BOM">
<source_id>
<Item action="get" type="Part" orderBy="generation" where="[Part].is_released ='0' AND is_current ='0'">
</Item>
</source_id>
</Item>
</AML>