AML Search Query - If name exists in any field, do not display in results

I am trying to look up work orders where the specified name is not anywhere on the distribution. Currently the way it is set up, it will display work orders where "John Doe" is included because there are more than one lines on distribution and while it finds the name on one line, it won't find it on another.

So is there a way to create a search where it searches all names on distribution, if it shows up even once to not display that work order in results?

Any help is welcomed! Thank you!

<Relationships>

    <Item type="Work Order Distribution" action="get">

      <_assigned>

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

          <NOT>

            <keyed_name condition="like">John Doe</keyed_name>

          </NOT>

        </Item>

      </_assigned>

    </Item>

  </Relationships>

Parents
  • Hi jthoma,

    I am not sure I fully understand your question, can you give me some more details on what you are trying to do? Are you trying to only query for the relationships not containing the Identity John Doe in your Work Order Distribution relationship? If possible this might be easier to create within a method instead of AML. Take a look at this example sudo code:
    C#:
    Innovator inn = this.getInnovator();

    Item workorder = inn.newItem("Work Order""get");

    workorder.setAttribute("select""id, physical_part, workorder_id");

    Item rel = workorder.createRelationship("Work Order Distribution""get");

    rel.setAttribute("select""source_id,id,owned_by_id");

    workorder = workorder.apply();

    // get relationships

    Item distributions = workorder.getRelationships("WO_WorkOrder Distribution");

    //Loop through relationships

    for(int i=0; i<distributions.getItemCount(); i++) {

        // Get Identity property (owned_by_id maybe)?

        //if ownned_by_id is not John Doe

            // then return only these

    }
    Hope this helps!
    Nithin
Reply
  • Hi jthoma,

    I am not sure I fully understand your question, can you give me some more details on what you are trying to do? Are you trying to only query for the relationships not containing the Identity John Doe in your Work Order Distribution relationship? If possible this might be easier to create within a method instead of AML. Take a look at this example sudo code:
    C#:
    Innovator inn = this.getInnovator();

    Item workorder = inn.newItem("Work Order""get");

    workorder.setAttribute("select""id, physical_part, workorder_id");

    Item rel = workorder.createRelationship("Work Order Distribution""get");

    rel.setAttribute("select""source_id,id,owned_by_id");

    workorder = workorder.apply();

    // get relationships

    Item distributions = workorder.getRelationships("WO_WorkOrder Distribution");

    //Loop through relationships

    for(int i=0; i<distributions.getItemCount(); i++) {

        // Get Identity property (owned_by_id maybe)?

        //if ownned_by_id is not John Doe

            // then return only these

    }
    Hope this helps!
    Nithin
Children