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 - Get Related Items Data from Where Used AML

jsnosal - Thursday, November 6, 2014 10:12 AM:

Is there a way to pull the the data out of the relatedItems in the AML query? I'm trying to build a report that shows all the affected parts on an AML change. I'm just having trouble getting the the relationship data out of the part data. So I want to do a where used on the Manufacture Part, then get the details on the Parts its attached to. Similar to a multi BOM query, but the top line is a where used instead of a get. 

Manufacture Part > Part

Current Query

<Item action="getItemWhereUsed" type="Manufacturer Part" id="123456ABC">

</Item>

Query I'm Trying to Get to Work

<Item action="getItemWhereUsed" type="Manufacturer Part" id="123456ABC">

        <relatedItems>

        <Item type="Part" action="get">

        <Relationships>

        <Item type="Part BOM" select="sort_order,quantity,reference_designator,related_id(item_number,name)"/>

        </Relationships>

        </Item>

        </relatedItems>

</Item>

 

Current Results

<SOAP-ENV:Envelope xmlns:SOAP-ENV="schemas.xmlsoap.org/.../">

  <SOAP-ENV:Body>

    <Result>

      <Item type="Manufacturer Part" id="123456ABC" icon="../Solutions/PLM/images/Icons/16x16/16x16_ManufacturerPart.gif" keyed_name="Manufacturer Part - 02-2-REV1 - 1.3" loaded="1">

        <relatedItems>

          <Item type="Part" id="654654654" icon="../Solutions/PLM/images/Icons/16x16/16x16_Part.gif" keyed_name="Part - E006 - 1.3" />

          <Item type="Part" id="987987799" icon="../Solutions/PLM/images/Icons/16x16/16x16_Part.gif" keyed_name="Part - E007 - 2.4" />

        </relatedItems>

      </Item>

    </Result>

  </SOAP-ENV:Body>

</SOAP-ENV:Envelope>



Eric Domke - Friday, November 21, 2014 11:11 AM:

I am a particular fan of using a SQL in clause to handle these sorts of situations.  In particular, something similar to the AML below should get you what you are looking for.

<Item type="Part" action="get">

  <id condition="in">(select source_id from innovator.[PART_AML] where related_id = '123456ABC')</id>

  <Relationships>

    <Item type="Part BOM" select="sort_order,quantity,reference_designator,related_id(item_number,name)"/>

  </Relationships>

</Item>