Forum Discussion
Hi Hadrien
Edit and Update operation will do the same and change the generation. However below are the differences
Differences b/w Edit and Update
Edit - Will lock the item, Update the changes, Unlock the item
Update - Check whether the item is locked or not, Update the changes if it is locked, Leave the item remain locked.
So, when you apply Upate action, System will check whether item is already locked or not and throw Item not locked exception.
Usage
Edit - Can be used in executing the query in Nash / Innovator Admin tool.
Update - Can be used in Server / Client side method where item is locked already and need to keep that item locked by same user.
Solution for this Question
Use Version = '0' in your AML query to prevent changing the generation
<AML>
<Item action='edit' type='myItem' where="[myItem]._title='myItemName' and [myItem].generation='1'" version='0'>
<myItemProperty>
<Item type="myItemProperty" action="get" select="id">
<keyed_name>myItemPropertyName</keyed_name>
</Item>
</myItemProperty>
</AML>
If you know the exact ID of the generation you want to update, then this query can be simplified
<AML>
<Item action='edit' type='myItem' id='ID OF EXACT GENERATION' version='0'>
<myItemProperty>
<Item type="myItemProperty" action="get" select="id">
<keyed_name>myItemPropertyName</keyed_name>
</Item>
</myItemProperty>
</AML>
Note: If you really want to use Update action in you query then below query will work
<AML>
<Item action='lock' id='ID OF EXACT GENERATION YOU WANT TO LOCK AND UPDATE' type='myItem'>
</Item>
<Item action='update' type='myItem' where="[myItem]._title='myItemName' and [myItem].generation='1'" version='0'>
<myItemProperty>
<Item type="myItemProperty" action="get" select="id">
<keyed_name>myItemPropertyName</keyed_name>
</Item>
</myItemProperty>
</Item>
</AML>
Thank You
Gopikrishnan R
Thanks for you replies I will test it :)
Best regards,
Hadrien