Prev Next

Boxed List

A DMN Boxed List is a Decision element that contains a list of boxed expressions. These items are arranged as a vertical list in the DMN Expression window.

A Boxed List is often used in conjunction with a for loop expression that is contained in a related Decision element. The for loop expression is used to iterate over each row in the Boxed List, binding the List's Element-field to the corresponding variable, and evaluating the expression in the scope. The output of the for loop is a list containing the evaluation of the expression for each individual iteration.

Access

Diagram Toolbox

Drag a Decision element or BKM element from the Toolbox onto a DMN diagram, and select 'List' from the pop-up expression menu.

Double-click on the DMN element; the DMN Expression window is displayed, showing details of the selected element.

Properties

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 'List'. Click on the OK button.

Double click on the DMN element; the DMN Expression window is displayed, showing details for the selected element.

Overview

It is common for Boxed Lists to be used as Enumerations, where all List items are of the same type.

It is also common for Boxed Lists to be used as a collection of data, where each item might have a different type.

Editing Boxed Lists

The DMN Expression window has a toolbar providing the options 'Add New List Item', 'Delete Existing List Item' and 'Move Item Up or Down'.

Right-click on a List item to display context menu options for setting the List item's type - string, number, boolean or object.

Example - Poker Rank and Suit

In this example, we have three Decisions: Rank, Suit and Rank Suit Combination

  • Decision Rank is represented as a Boxed List with 13 Items from 'A' through to 'K'
  • Decision Suit is represented as a Boxed List with 4 Items: 'Club', 'Diamond', 'Heart' and 'Spade'
  • Decision Rank Suit Combination is represented as a Literal Expression with a for loop: for r in Rank, s in Suit return s + r

When multiple iteration contexts are defined in the same for loop expression, the resulting iteration is a cross-product of the elements of the iteration contexts. The iteration order is from the inner iteration context to the outer iteration context.

In this example, the cross-product of Rank (13 items) and Suit (4 items) is a list of 13 * 4 = 52 elements.

Learn more