DMN hit policies

The hit policy is a single letter in the corner of a decision table, and it decides everything about how the table behaves when more than one rule matches.

It is the part most often ignored and most often the cause of a surprise in production.


#When it matters

  • Any table where two rules could match the same input.

  • Decisions that will be executed rather than only read.


#The symbols

Symbol

Means

U (Unique)

Exactly one rule may match. Overlap is an error, which is useful.

A (Any)

Several may match, but they must produce the same output.

F (First)

Rules are ordered; the first match wins.

P (Priority)

The highest-priority output value wins, regardless of row order.

C (Collect)

Every match contributes; optionally sum, min, max or count.

R (Rule order)

Every match, in rule order.

O (Output order)

Every match, in output priority order.


#A few things that catch people out

  • Unique is the safest default. It turns overlapping rules into an error rather than a silent choice.

  • First hides overlaps behind row order, which makes reordering rows a behaviour change.

  • Collect with an aggregator (sum, count) returns one value; without one it returns a list.



Pick the hit policy on purpose.