This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Override the "ID" requirement for actions

csimpson - Monday, December 22, 2014 9:04 PM:

Hello, I'm very new!!

Many "actions" in AML require the Item's ID. But I thought it would be useful to perform those actions (such as delete!) without knowing the part's ID. So I was wondering if there was a way to do the following instead:

    1) perform a query

    2) apply the action to each result

 

Maybe if there's a way to store the ID's of the query as a 'variable(s)', then using that variable to specify the ID. Something like the following?

<Item type="Part" action = "getIDs">  *getIDs returns a list (called "IDList") of IDs that match the criteria 

      <name condition = "like">*truck*</name>

      </Item>

<Item type="Part" action="Delete" ID=IDList></Item>  *Delete all of the parts with 'truck' in the name

 

I'm guessing there'd have to be some sort of looping involved. 

Please let me know if anything similar exists. Am I overextending the capabilities of AML? Is this where I need to start utilizing C#, JS, or VB? My background is in MATLAB so I'm always inclined to define and pass variables to get what I want. Thank you.

 

 

 



DavidSpackman - Sunday, January 11, 2015 7:17 PM:

Welcome!

You can also use the "where" attribute instead of id=""...


Here is some examples (You can get very creative...)

<Item type="Part" action="delete" where="[Part].name LIKE '%truck%'">
</Item>
<Item type="Part" action="delete" where="[Part].item_number = 'abc123'">
</Item>
<Item type="Part" action="delete" where="[Part].id= '4984B7FE92CB45F29BC20AD2A6FACAE7'">
</Item>
<Item type="Workflow Process" action="get" where="[Workflow_Process].name like 'NCR%' 
AND [Workflow_Process].name <= 'NCR000007'"></Item>
<Item type="Workflow Process" action="get" where="[Workflow_Process].name LIKE 'NCR%' 
AND [Workflow_Process].closed_date IS NULL" select="id"></Item>

 

www.aras.comhttp:/.../10401.aspx

<Item type="Part" action="get">
    <id condition="in">
    (
    SELECT
        pb.SOURCE_ID
    from 
        innovator.PART_BOM pb
        INNER join innovator.SIMPLE_MCO_PART smp on smp.RELATED_ID = pb.RELATED_ID
    where 
        smp.SOURCE_ID = {@id}
    )
  </id>
</Item>
http://www.aras.comhttp://www.aras.com/Community/forums/t/7103.aspx

 

Dave



DavidSpackman - Monday, January 12, 2015 1:05 AM:

To finish answering your question, not possible to use the results of the AML query in subsequent queries. 

You would need to start using the IOM for that. See the Programmers Guide for reference.

 

Dave