Discount by customer tier (DMN)
The simplest useful decision table: a discount that depends on tier and order value. Unique as the hit policy means overlapping rules become a visible error.
#What this example shows
Two input columns and one output.
FEEL ranges rather than a row per value.
A Unique hit policy, so overlap cannot pass silently.
#Columns
Column | Type and meaning |
|---|---|
Tier (input) | string: bronze, silver or gold |
Order value (input) | number: the order total |
Discount (output) | number: percentage applied |
#The decision table
Hit policy: U (Unique). Cells are FEEL expressions, so a range, a list or a negation is a legal value; a dash means the input is irrelevant to that rule.
Tier | Order value | Discount % | Notes |
|---|---|---|---|
"bronze" | < 500 | 0 | No discount below the threshold |
"bronze" | [500..2000) | 2 | |
"bronze" | >= 2000 | 5 | |
"silver" | < 500 | 2 | |
"silver" | [500..2000) | 5 | |
"silver" | >= 2000 | 8 | |
"gold" | < 2000 | 8 | |
"gold" | >= 2000 | 12 | Capped by policy at 12 |
#Making it your own
Add a third input for promotional codes rather than duplicating every row.
Set allowed values on the tier column so a typo becomes an error.
If the table grows past about twenty rows, split the decision in two.
#Related
The hit policy is the whole decision.
