Skip to content
DMN templates

DMN — Stacking Discounts (COLLECT with a sum)

The hit policy that changes what an overlap means. Under COLLECT-sum, two rules firing together is the design rather than a contradiction, so overlaps are counted and reported as intended rather than accused — which is the distinction almost every decision-table tool gets wrong.

Template previewDMN
Order discountOrderCustomer recordDiscount percentageinformation requirementDiscount percentage — Collect (sum)C+Value[0..100000]Tier{ Bronze, Silver, Gold }PromobooleanPct[0..100]AnnotationR1---0base: everything matches thisR2[1000..100000]--5volumeR3-Silver-3loyaltyR4-Gold-7R5--true10campaignNo overlaps and no gaps over the declared input space · 1 decision · 2 input data · 1 table · 5 rules9 rule pairs overlap, which Collect resolves by design.

What this template contains

Source
18 lines

Make it your own.

title "Order discount"

input    Order    "Order"
input    Customer "Customer record"
decision Discount "Discount percentage"

Order    -> Discount
Customer -> Discount

decision Discount "Discount percentage" {
  hit C+
  input  Value  number [0..100000]
  input  Tier   enum { Bronze, Silver, Gold }
  input  Promo  boolean
  output Pct    number [0..100]

  rule -                | -      | -     -> 0   // base: everything matches this
  rule [1000..100000]   | -      | -     -> 5   // volume
  rule -                | Silver | -     -> 3   // loyalty
  rule -                | Gold   | -     -> 7
  rule -                | -      | true  -> 10  // campaign
}