Aras Innovator Platform

Building a Relationship Structure

It is possible to define a Relationship from the context item that can go either up or down the data structure. ‘Down’ refers to a relationship direction starting from the Item representing the source side of the relationship and following the related content to the related Item. ‘Up’ by contrast refers to a relationship direction starting from the Item representing the related side of the relationship and following the related content to the source Item. It is also possible to set up a recursive structure, such as the Part --> Part BOM --> Part, to reuse the same logic for multiple levels. The following procedures show how to expand the query both up and down for a Part Query and introduces recursion.

Building a Downward Relationship Structure

  1. Right-click on the Part Context Item and select Add Related Item --> Using Relationship.

    Figure 8.

  2. Select the Relationship to include in the structure. In this case, select BOM, check Include Related and click Add.

    Figure 9.

    The query now looks like shown in figure 10. Note that the Part_1 alias is assigned to the related Part Query Element in the list.

    Figure 10.

  3. Right-click the Part Context Item and click Add Related Item --> Using Relationship. In this case, click while pressing Ctrl to select Documents and CAD Documents. Select Include Related.

    Figure 11.

  4. Right-click on the top Context Item and select Add Related Item --> Using Item Property. Select an Item Property to add to the query structure. In this case, select created_by_id.

    Figure 12.

  5. Use the following procedure to specify the desired Properties for each new element in the Query Definition:

    Note
    Optionally, you can also set Order By settings as well.

    1. For [created_by_id] User, specify the following properties:

      • Item ID
      • First Name
      • Last Name
      • Login Name

    2. For [Relationship] Part CAD, specify the following property:

      • Sequence
    3. For [Related] CAD, specify the following properties:

      • id
      • Document Number
      • Name
      • State

    4. For [Relationship] Part Document, specify the following property:

      • Sequence
    5. For [Related] Document, specify the following properties:

      • id
      • Document Number
      • Name
      • State

  1. Change the Alias on the CAD Documents element to “Part CAD”:

    1. Right-click CAD Documents and click Change Alias.

      Figure 13.

    2. Enter Part CAD as the name and click the check mark.

      Figure 14.

  2. Use the same procedure to change Documents Relationship to Part Document.
  3. Use the same procedure to change User Relationship to Part Created By.
Note
Each element on a given level must have a unique alias.

  1. Save the Query Definition.

Building an Upward Relationship Structure

  1. Right-click the top Part element and click Add Related Item --> Using Referencing Item.

    Figure 15.

  2. Select an appropriate Referencing item from the structure. In this case, select Simple MCO Part.

    Figure 16.

  3. Right-click the Simple MCO Part element and click Add Related Item --> Using Item Property to select source_id.

    Figure 17.

  4. Set Selected Properties on the Simple MCO element to:

    • id
    • MCO Number
    • Status
    • Date Originated
  1. Save the Query Definition.

Adding a Recursive Call Structure

Recursive structures can reuse sections of the already defined queries. The following example shows how to set up a recursive call for the Part --> Part BOM --> Part relationship structure.

  1. Right-click on the top-level Part element and add the Part BOM --> Part structure.

    Figure 18.

  2. For the BOM element, select the following properties:

    • Sequence
    • Quantity
    • related_id
  1. Right-click on the child Part element and click Reuse Query Element Definition.

    Figure 19.

  2. Select the top-level Part element and click Add.

    Figure 20.

  3. Save the Query Definition item.

The child Part item now includes a search for the same elements as the top-level Part, including CADs, Documents, other Parts, etc. It also includes the same Properties and Order By logic as specified above.