Literal and Boxed Expressions
The logic of a DMN decision is a boxed expression: a FEEL expression in a standard graphical box. The decision table is one of them. The others:
| Boxed expression | What it is | Example |
|---|---|---|
| Literal expression | One FEEL expression in a box | if score >= 80 then "low" else "high" |
| Context | Named entries, each a boxed expression, and an optional final result; later entries can use earlier ones | net: amount * 0.84, tax: amount - net, result {net: net, tax: tax} |
| Invocation | A call of a business knowledge model with values for its parameters | Risk score with age = customer.age, income = customer.income |
| Relation | A table of values: a list of contexts with the same columns | A price list of products and prices |
| List | A vertical list of boxed expressions | Three thresholds, one per row |
| Function definition | Parameters and a body, the logic of a business knowledge model | function(amount, rate) amount * rate |
| Conditional (DMN 1.4) | if, then and else, each in its own box | If VIP, then the VIP table, else the standard table |
| Filter (DMN 1.4) | A list and a condition | The open orders |
| Iterator (DMN 1.4) | for, some or every over a list, in boxes | The amount of every order |
The Literal Expression
The literal expression is the simplest logic: one FEEL expression whose value is the result of the decision. It suits calculations and short rules:
| Decision | Literal expression |
|---|---|
| Net price | order.amount * (1 - discount.percent / 100) |
| Approver | if order.amount >= 10000 then "CFO" else if order.amount >= 1000 then "Manager" else "Team lead" |
| Deadline | today() + duration("P5D") |
| Is urgent | contains(lower case(summary), "urgent") or priority = "Highest" |
Since FEEL itself has contexts, lists, if, for, some, every and filters, a literal expression can express what the context, list, conditional, filter and iterator boxes draw. The boxes make large logic easier to read, the result is the same.
In Flower BPM
| Boxed expression | What Flower BPM does |
|---|---|
| Decision table | Evaluated, with every hit policy. See Hit Policies. |
| Literal expression | Evaluated with FEEL. The result is the value of the expression (a number, a text, a context, a list). |
| Context, invocation, relation, list, function definition, conditional, filter, iterator | Not evaluated. A decision with such logic gets an error when it runs: The decision … is no decision table and no literal expression, the result is null, and the process goes on. |
To use such logic in Flower BPM, write it as a literal expression (a FEEL context {net: ..., tax: ...}, a list, if ... then ... else, for), or split it into decisions that require each other in the DRD. The DMN modeler of Flower BPM offers decision tables and literal expressions. See DMN Coverage.