A Boxed Context is a collection of context entries, presented in the form of a table, followed by a final result expression.
These context entries consist of a variable paired with a value expression and can be thought of as intermediate results. This allows for complex expressions to be decomposed into a series of simple expressions, with the final result being evaluated in a much simpler form.
The Boxed Context type is supported in both the Decision and the Business Knowledge Model element types. It is denoted by the icon.
On a diagram, double-click on a Decision element or BKM element.
The DMN Expression editor window is displayed, showing details for the selected element.
This image shows the DMN Expression editor window as it appears for a Boxed Context expression.
A Boxed Context is a collection of context entries, presented in the form of a table, followed by a final result expression. Each context entry consists of a variable and a value expression. The variable can be considered as an intermediate result, and it can be used within the value expression of any subsequent context entry. The value expression of a context entry can be either a Literal Expression or an Invocation, and can make use of any available inputs such as parameters (to a BKM element), InputData or decision results, as well as any previously defined context variables.
The final result of a Boxed Context expression is determined by working through each context entry in turn, evaluating the value expression and assigning its result to the variable, then finally evaluating the result expression. The result expression can also make use of any input or local variable, but must evaluate to provide a result.
Toolbar for Boxed Context Editor
When a Boxed Context expression is selected, the layout of features accessible in the DMN Expression window is:
For more details refer to the Help topic 'Toolbar for Boxed Context Editor'.
In the case of BusinessKnowledgeModel elements, parameters are used to pass input values supplied by the invoking element. The BKM's decision logic is evaluated using the input parameters and the result is returned to the invoking element. By default, a BKM element is created with two input parameters, 'Input 1' and 'Input 2'.
Click on the icon in the toolbar of the DMN Expression window to display the 'Edit Parameters' window.
Here you can change the parameter names, set their data types, create additional parameters or delete existing ones.
Specifying Context Entries
Each context entry consists of a variable-expression pair.
The variable name can be any text that you like and can even contain spaces. To edit the variable name, click on the cell to select it, then click again or pressto enter edit mode. To exit edit mode, click elsewhere or press the .
In general, it is not necessary to specify a data type for the expression or variables - the type will be inferred from the value. However, if you intend to generate code for compiled languages such as Java, C++ or C#, you will have to specify the type of all context entry variables.
The value expression of a context entry can be either a Literal Expression or an Invocation and can make use of any available inputs, such as parameters (to a Business Knowledge Model element), InputData or decision results, as well as any previously defined context variables. Right-clicking on the expression cell displays a pop-up menu that provides options for displaying an expression code editor, or for setting the value expression as an If-Else statement or an Invocation.
You can also edit the value expression by entering text directly into the expression cell.
For further information on how to specify Literal Expressions or Invocations, please see the Help topics covering those subjects.