Camunda DMN hit policy

I need to create a dmn file where input columns are type and country and output is PII and required

type: type1, country: usa, PII: pii1, required: true
type: type1, country: usa, PII: pii2, required: true
type: type2, country: china, PII: pii3, required: false
type: - , country: china, PII: pii4, required: false
type: - , country: -, PII: pii5, required: true

Below is a sample dmn file. My requirement is more complex. But neither unique nor collect hit policy works. I can’t make PII as an array

forum.dmn (3.6 KB)

What hit policy to be used?

for type: type1, country: usa, I want PII pii1 and pii2
for type: type2, country: china, I want PII pii3
for any othertype, country: china, I want PII pii4
for any othertype and anyother country, I want PII pii5

The decision table contains default cases - rows with an empty input clause that should match if other rules don’t match. You can the default cases with the FIRST hit policy. It returns the first rule that matches.

However, the FIRST hit policy returns only one rule. If you need to return multiple rules, you need the COLLECT hit policy. To avoid the COLLECT hit policy returns the default cases, you need to define the input causes with the reverse condition, for example, not("type1", "type2"), not("usa", "china").

@Philipp_Ossler

Can I have an output column which returns array of object.


[{key1: value1, key2: [value2]}, {key3: value3, key2: [value2]}]

Can I do json.stringify and pass the generated string as an output value from dmn?