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

Parents
  • Hi Don,

    Is there a particular reason you're using AML for this task? Personally I'd write a short C# Method to gather this information.

    The flow would look something like:

    1. Get all Parts
    2. For each part, do a get on all Part BOM relationships with the same source ID
    3. Check how many relationships are returned in that get
    4. If count == 1, then we can use the related ID to get the information about the child part.
    5. Store in some list and return

    Let me know if that works!

    AJ

  • 0 オフライン in reply to AJ Sebastian

    AJ,

    Thank you for your reply.  Unfortunately, I am not familiar with C# or where I would even do that query.  

  • +1 オフライン in reply to dkinsley

    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:

    var inn = this.getInnovator();
    
    var parts = inn.newItem("Part","get");
    parts = parts.apply();
    List<string> relPartList = new List<string>();
    List<string> sourcePartList = new List<string>();
    for (int i = 0; i < parts.getItemCount(); i++){
      var currPart = parts.getItemByIndex(i);
      var bomRel = inn.newItem("Part BOM","get");
      bomRel.setProperty("source_id",currPart.getID());
      bomRel = bomRel.apply();
      if (bomRel.getItemCount() == 1){
        relPartList.Add(bomRel.getProperty("related_id"));
        sourcePartList.Add(currPart.getID());
      }
    }
    
    return inn.newResult("Parts with 1 Item in EBOM: " + String.Join(",",sourcePartList));

    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

  • 0 オフライン in reply to AJ Sebastian

    Running the AM idlist attribute gave me all the part numbers with only one eBOM item but I still don't have the part number or ID of the single eBOM item.  Did I miss something? 

  • 0 オフライン in reply to dkinsley

    If you want to get the related Items I'd recommend something like this 

    <Item type="Part" id="ACBDEF0123456789…" action="get">
    <Relationships>
    <Item type="BOM" action="get"/>
    </Relationships>
    </Item>

    (This sample is directly from the Programmers Guide, which you should check out for AML tips)

    This will show the relationship and should give you information about the related part. 

Reply Children