Prev Next

Literal Expression

A Literal Expression is the simplest form of DMN expression; it is commonly defined as a single-line statement, or an if-else conditional block. The Literal Expression is a type of value expression used in both Decision elements and Business Knowledge Model (BKM) elements. As the expression becomes more complex, you might prefer a Boxed Context or, in order to improve the readability, you can encapsulate some of the logic as a function in the DMN Library.

The icon on the top right corner of the Decision or BKM element indicates that it is implemented as a Literal Expression.



On a diagram, double-click on a Decision element or BusinessKnowledgeModel element.

The DMN Expression editor window displays showing details of the selected element.


This image shows the DMN Expression editor window, as it appears for a Literal Expression.

The Literal Expression is a textual representation of the decision logic.  It describes how an output value is derived from its input values, using mathematical and logical operations.

The expression editor window presents the Literal Expression as a table, with two key rows:

  • Parameters:  defines the input parameters used in the expression
  • Literal Expression:  where the formula for the expression is defined - this defines the output of the Decision

In order to support simulation and execution, the literal expression can use JavaScript global functions or JavaScript object functions. Users can also create DMN Library functions for use within the expressions.

Toolbar for Literal Expression Editor

When a Literal Expression is selected, the layout of features accessible in the DMN Expression window is:

For more details refer to the Help topic Toolbar for Literal Expression Editor.

Expression Editor and Intelli-sense support

In accordance with the Friendly Enough Expression Language (FEEL) language specification, parameter names can contain spaces, which makes the expression easier to read. Enterprise Architect also provides Intelli-sense support for editing the expressions, allowing for minimal typing and fewer mistakes.

Given a decision hierarchy such as the one shown, when editing the expression for 'Decision1', the inputs to 'Decision1' - namely 'Decision2', 'Decision3', 'InputData1' and 'InputData2' - will be available through Intelli-sense in the editor.

By right-clicking on the 'Expression' row of the DMN Expression window, then choosing the menu option 'Edit Expressions...', the expression code editor dialog is displayed. Pressing Ctrl+Space displays the Intelli-sense menu:

  • For 'Decision' elements, all of the inputs to the decision will be displayed
  • For Business Knowledge Model (BKM) elements, all of the input parameters will be displayed

The DMN Model can be generated as source code in JavaScript, Java, C# or C++; since some languages might have different syntax for some expressions, Enterprise Architect provides language override pages for each language. If no override code is specified for a language, the expression defined for the FEEL language will be used.

In the generated code, the space inside a variable name will be replaced by an underscore.

Learn more