Query help needed
Can someone help me with an AML query to find...
- all of our parts in Innovator that have only one item in the EBOM
- what revision sequence each part is assigned
- what the single EBOM item part number is
Don
I went ahead and whipped up a quick method which you can add to your instance and execute to get all the parts with exactly 1 BOM Relationship:
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:d4e06a2a-e62e-40f1-81f1-ba4ed2737dd7:type=text&text=var%20inn%20%3D%20this.getInnovator%28%29%3B%0D%0A%0D%0Avar%20parts%20%3D%20inn.newItem%28%22Part%22%2C%22get%22%29%3B%0D%0Aparts%20%3D%20parts.apply%28%29%3B%0D%0AList%3Cstring%3E%20relPartList%20%3D%20new%20List%3Cstring%3E%28%29%3B%0D%0AList%3Cstring%3E%20sourcePartList%20%3D%20new%20List%3Cstring%3E%28%29%3B%0D%0Afor%20%28int%20i%20%3D%200%3B%20i%20%3C%20parts.getItemCount%28%29%3B%20i%2B%2B%29%7B%0D%0A%20%20var%20currPart%20%3D%20parts.getItemByIndex%28i%29%3B%0D%0A%20%20var%20bomRel%20%3D%20inn.newItem%28%22Part%20BOM%22%2C%22get%22%29%3B%0D%0A%20%20bomRel.setProperty%28%22source_id%22%2CcurrPart.getID%28%29%29%3B%0D%0A%20%20bomRel%20%3D%20bomRel.apply%28%29%3B%0D%0A%20%20if%20%28bomRel.getItemCount%28%29%20%3D%3D%201%29%7B%0D%0A%20%20%20%20relPartList.Add%28bomRel.getProperty%28%22related_id%22%29%29%3B%0D%0A%20%20%20%20sourcePartList.Add%28currPart.getID%28%29%29%3B%0D%0A%20%20%7D%0D%0A%7D%0D%0A%0D%0Areturn%20inn.newResult%28%22Parts%20with%201%20Item%20in%20EBOM%3A%20%22%20%2B%20String.Join%28%22%2C%22%2CsourcePartList%29%29%3B]
To utilize this, you can create a new method in Innovator, make sure it's a server method. Then once it's saved you should be able to run the following action (Run Server Method):
The output should pop up. It'll be a list of IDs for all the parts that have exactly 1 BOM Relationship. After that you should be able to use that list for an AML Query using the idlist attribute.
AJ