DMN decision table

From FlexRule Wiki
Jump to: navigation, search

Decision Model and Notation Decision Table

A DMN decision table consists of:

  • name,
  • set of inputs, each input optionally associated with a type and list of input values,
  • set of outputs, each output optionally associated with a type and list of output values,
  • list of rules in rows or columns of the table, where each rule is composed of the specific input entries and output entries of the table row (or column),
  • hit policy,
  • Aggregation - only applicable in decision table with multiple hits policy. (by setting 'processAll' or Process All Rows to true) Check API

Multiple Hits Policy for Single Output Decision Table

There are three types of multiple hits policies for a single output Decision Table. (Multiple Hits Policies for Single Output)

  1. No order: Returns all hits in a unique list in arbitrary order.
  2. Output order: Returns all hits in decreasing priority order. Output priorities are specified in an ordered list of values.
  3. Rule order: Returns all hits in rule order, i.e. dependency on the order of the rules.

When a multiple hits table returns output entries from multiple rules, the output entries have to be aggregated into a singe result. An Aggregation specifies the function to handle the multiple output entries.

  1. Collect: The result of the decision table is the list of all the outputs, ordered or unordered per the hit policy.
  2. Sum: The result of the decision table is the sum of all the outputs.
  3. Min: The result of the decision table is the smallest value of all the outputs.
  4. Max: The result of the decision table is the largest value of all the outputs.
  5. Count: The result of the decision table is the number of outputs.
  6. Average: The result of the decision table is the average value of all the outputs, defined as the sum divided by the count.

Automatic Collection

In a Multiple Hits Policies for Single Output the expression for the action can be left empty. Decision table automatically creates a collection for the output parameter and you can collect the result later. This collection is a generic 'List' and the results will be added to this list and then aggregate function will be ran on top of it when the decision table execution is finished. For more example please have a look at: http://www.flexrule.com/archives/decision-table-aggregation/

What's next?

  1. Introduction to decision table
  2. Preparing decision table
  3. Modeling decision table
  4. Decision Model and Notation - decision table
  5. Check overlaps
  6. Decision Table final logic
  7. Multilingual decision table
  8. Decision Table 101

Tutorials

  1. Decision Table Hello World