Custom AML - Select="max(generation)" - How to use SQL MAX in query?

Former Member
Former Member
Trying to write up a saved search to make viewing the generations of a part more convenient.  I am attempting to use the SQL standard MAX() in my "select" string, but am not having any luck. The AML is still returning the proper search, but the MAX is being discarded. What am I missing here?
Parents
  • Hello, By default, the generation property does not reset whenever an Item's major_rev is increased. Instead, we can take advantage of the fact that the major_rev property is increased whenever an item is edited from a Released state. Because of this, we can run the AML query below to look for only the latest generation of each Major Revision of an item.
    <AML>
    <Item type="Part" action="get">
    <state>Released</state>
    <generation condition="gt">0</generation>
    </Item>
    </AML>
    Note, that we query using the generation tag in the AML in order to return all instances of a Part, not just the most current version. As a general practice, we recommend against using direct SQL in a Method as it bypasses the Aras permission model. Lastly, could you please provide the scenario where your item is not incrementing the major_rev? Chris ____________________________________ Christopher Gillis Aras Labs Software Engineer
Reply
  • Hello, By default, the generation property does not reset whenever an Item's major_rev is increased. Instead, we can take advantage of the fact that the major_rev property is increased whenever an item is edited from a Released state. Because of this, we can run the AML query below to look for only the latest generation of each Major Revision of an item.
    <AML>
    <Item type="Part" action="get">
    <state>Released</state>
    <generation condition="gt">0</generation>
    </Item>
    </AML>
    Note, that we query using the generation tag in the AML in order to return all instances of a Part, not just the most current version. As a general practice, we recommend against using direct SQL in a Method as it bypasses the Aras permission model. Lastly, could you please provide the scenario where your item is not incrementing the major_rev? Chris ____________________________________ Christopher Gillis Aras Labs Software Engineer
Children
No Data