Configure Relations

You can use a relation notation as a convenient shorthand to represent multiple contexts.

A relation decision is a list of similar contexts in a pivoted or transposed layout. In other words, each column name is the common key attribute for all cell entries under it, which essentially are the value attributes. For details about contexts and key-value pairs, see Configure Contexts. In a relation decision, each cell entry is an independent logical notation.

In the output of a relation decision, outputs of all contexts within it are clearly distinguished. You can also invoke the output of a particular context or context entry from another decision.

To add a relation decision to the canvas and define its properties, see Add Decisions.

Follow these steps to configure the decision's logic:

  1. Double-click the relation node to access its logic editor.
    Alternatively, select the node, and click Edit or View Decision Logic icon on the sidebar.
  2. Click Add Column After Add Column icon or Add Row After Add Row icon to add additional rows or columns.
  3. Name each column in the header row.
  4. Enter the data in the cells of the rows below. All cells have the expression notation selected by default.
    1. To change the logical notation for a cell, click the cell, click Options icon above the table on the right, then Change Value, and then select a different notation from the available options.

      Note:

      • You cannot insert a decision table within a relation.
      • If you add a function as one of the cell entries, the relation as a whole doesn’t return a result. However, you can invoke results of individual cell entries or contexts throughout the decision model.
    2. Configure the logic for the selected notation within each cell.
  5. Additionally, you can move or replicate the data of an entire row to another row, or a column to another column. Click to select a row or column, click Options icon above the table on the right, and select the required action.
  6. To reuse the entire logic definition in another decision, cut or copy it and paste it into the desired decision. Click Options icon in the header and select the required action.
  7. To delete a row or column, click it, and then click Delete Delete icon.
Changes you make within the decision model are automatically saved and validated. Errors and warnings, if any, are displayed in the editor. Click the error or warning icon to review and fix them. See Review and Fix Errors in a Decision.

The following image shows a relation decision that contains the inventory information for a phone brand:

The image shows a Relation decision called Phone Inventory. The decision contains a table, which has three columns and three rows. From left to right, the column names are: Color, Count, and Price. The cell entries for each row are: First row: “Black”, 2, and 500; Second row: “White”, 2, and 600; Third row: “Rose Gold”, 5, and 700.

Similar to list notations, use either Phone Inventory[1] or Phone Inventory[-3] to access the entire context related to black-colored phones. To access all cell entries of a particular column, use the relation name in combination with the column name, for example, Phone Inventory.Price returns all entries of the Price column. To access a particular context entry (for example, “700”), use Phone Inventory.Price[3], Phone Inventory.Price[-1], or Phone Inventory[Color="Rose Gold"].Price.

The following image shows the result of the entire relation decision, which has each context listed separately:

The image shows the result of the relation decision, Phone Inventory. It is divided into three identical parts, one for each context. Each part contains a table of two columns and three rows. The first table contains Color, Count, and Price entered (from top to bottom) in the cells of the first column, and “Black”, 2, and 500 entered in the second column. The second table again contains Color, Count, and Price entered in the first column, and “White”, 2, and 600 in the second column. The third table contains Color, Count, and Price in the first column, and “Rose Gold”, 5, and 700 in the second column.