Book a Demo
Prev Next

Relation

A DMN Decision Relation element provides a convenient shorthand method for defining a list of related values in a DMN diagram. A Decision Relation is like a relation table with columns and rows. The header of the grid displays the name of each column. Each row displays the set of values for the corresponding columns.

Access

Toolbox

To create a Decision Relation:

  • Ensure the Perspective is set to: Requirements > Decision Modeling
  • From the DMN Components page of the Diagram Toolbox, drag a Decision element or BKM element onto a DMN diagram
  • Select 'Relation' from the pop-up expression menu
  • Double-click on the DMN element to display the DMN Expression window.

Alternatively, you can change an existing DMN Decision or BKM element to a Decision-Relation type. To do this:

  • Right-click on a DMN Decision or BKM element on the diagram, and select the 'Properties | Properties' menu option
  • On the General page, select the 'Tags' tab, and in the 'expressionType' value field click on the drop-down arrow and select 'Relation'; click on the OK button

Overview

The DMN Relation Decision-type is a vertical list containing rows of values. A key to using the Decision Relation is the means to iterate through the rows of values using a For Loop. The For Loop can be defined in, say, a related Literal Expression Decision as a formula to process the rows in the Decision-Relation element.

Editing DMN Relations

The DMN Expression window has a toolbar providing options to add a new row, delete an existing row and move the selected row up or down.

You can also:

  • Drag the grid header to reposition columns.
  • Right-click on the header cells to display the context menu options for setting the column's Type to: 'string', 'number', 'boolean' or 'object'.

Example - Loan Table

In this example, we have two Decisions - 'Loan Table' and 'Monthly Payment List' - and one Business Knowledge Model - 'Payment'.

'Loan Table' is a Decision implemented as a Relation with four columns: 'Loan', 'Principle', 'Term' and 'Annual Rate'.

'Monthly Payment List' is a Decision implemented as a Literal Expression with a for loop:

The for loop will iterate through 'Loan Table':

  • Each item 'x' is a row of the table, represented as a list
  • With each row item 'x', invoke Business Knowledge Model 'Payment' with the items in the row list
  • Each item in the list can be accessed in two different ways:
    (1) Directly access the Relation's column, like x.Loan, x.Term, x.Principle
    (2) Where the column name has a space, use string access: x["Annual Rate"]

On simulation, the runtime values show in the Simulation window and on the diagram beside the element; you can click on a step to see the simulation process.

Learn more