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 - Add a related item for the source Item

vishal_trivedi - Sunday, October 31, 2010 5:46 AM:

I am trying to add related Item by putting filter on the source Item below is the code which shows the relationship.

 

<AML>
    <Item type="Part" action="get">
        <part_no>101</part_no>
        <Relationships>
            <Item type="Part Document" action="get">
                <related_id>
                    <Item type="Document" action="get"></Item>
                </related_id>
            </Item>
        </Relationships>
    </Item>
</AML>

 

In the above code it shows that there is a part with part_no :--> 101. I want to add a document on the the same part what should be the code???

 

- Vishal



Brian - Monday, November 1, 2010 8:49 AM:

Hi Vishal,

If the Document already exists:

<AML>
<Item type="Part Document" action="add">
<source_id><Item type="Part" where="item_number ='000-0009'"/></source_id>
<related_id><Item type="Document" where="item_number='DOC-00001'"/></related_id>
</Item>
</AML>

This will create the relationship between the Part and the Document.

If the Document does not exist but the part does:

<AML>
<Item type="Part" action="edit" where="[Part].item_number ='000-0009'">
 <Relationships>
  <Item type="Part Document" action="add">
  <related_id>
   <Item type="Document" action="add">
    <item_number>DOC-000003</item_number>
   </Item>
  </related_id>
  </Item>
 </Relationships>
</Item>
</AML>

this will create the Document item and the relationship from the Part to the document.

Hope this helps.

Brian.



vishal_trivedi - Tuesday, November 2, 2010 8:01 AM:

Hi Brian

 

Thank you it works

 

-- Vishal