rvdijk - Monday, March 18, 2013 11:50 AM:
I decided to included RefDes info in our BOMs, also for existing BOMs. So I would like to update existing BOMs with help of AMLStudio. Unfortunately I do not manage to get the right code for updating BOM info.
This is the code I used for uploading initial BOM info
<AML>
<Item type="Part" action="edit" where="[PART].item_number='BOM#' and[PART].is_current='1'">
<Relationships>
<Item type="Part BOM" action="add"><related_id><Item type="PART" action="get" where="[PART].item_number='PART#' and [PART].is_current='1'"></Item></related_id><sort_order>10</sort_order><quantity>1</quantity></Item>
</Relationships>
</Item>
</AML>
How do I rebuilt this so I can update/include RefDes info to existing BOMs?
Thanks in advance for your help!
Jean-Marc - Monday, March 18, 2013 5:27 PM:
add the field reference_designator to your aml code.
<AML>
<Item type="Part" action="edit" where="[PART].item_number='BOM#' and[PART].is_current='1'">
<Relationships>
<Item type="Part BOM" action="add"><related_id><Item type="PART" action="get" where="[PART].item_number='PART#' and [PART].is_current='1'"></Item></related_id><sort_order>10</sort_order><quantity>1</quantity><reference_designator>wbs1</reference_designator></Item>
</Relationships>
</Item>
</AML>
rvdijk - Tuesday, March 19, 2013 2:52 AM:
That is what I tried already. That results in a new line in the BOM, but I want to update that particular line.
However if I choose ="Part BOM" action="edit" or ="Part BOM" action="update" I get an error message saying "MissingCriteriaException"
gks by TSI - Tuesday, March 19, 2013 4:15 AM:
as far as i know the attribute action="edit" only works with where="..."
that means you need to do:
<AML>
<Item type="Part BOM" action="edit" where="related_id='1234567890abcdef...'">
<sort_order>10</sort_order>
<quantity>1</quantity>
<reference_designator>name</reference_designator>
</Item>
</AML>
As the where-clause is passed to the sql server, you could do some little trick to avoid using IDS:
<AML>
<Item type="Part BOM" action="edit" where="related_id=(select id from [part] where item_number='PART#' and [part].is_current='1')">
<sort_order>10</sort_order>
<quantity>1</quantity>
<reference_designator>FrogsAndCats</reference_designator>
</Item>
</AML>
rvdijk - Tuesday, March 19, 2013 5:00 AM:
That works!!
Especially the part where="related_id=(select id from [part] where item_number='PART#' and [part].is_current='1')"> makes my day =D
Thanks a lot!