Chaining Decision Tables and collecting all the Rules hit

Hello experts,

I was working in a small POC where we have the following DRD:
dmn_chain_example.dmn (3.4 KB)

  • One decision table which uses Hit Policy: Collection. Let’s call it Decision1
  • Another decision table which uses Hit Policy: Collection too and has the output of the previous one as input. Let’s call it Decision2

Our use case is the following:
We want to have a decision table which does rules checks which are common and then chain it to other decision tables which are use case specific, but requires the common to be performed always.
In addition, we would love to collect ALL the results from the common and the specific one.

As you can see in the attached DMN, the Decision 2 has has a condition
count(commonInputValidationResults) > 0
This checks that the common produces or not check results. In that case, we use the inputVariable (which is the output of the common one) mapped directly to one of the results of the Decision 2

As result (via POSTMAN) we obtain the following reply.

We have a JSON Object per rule failed and collected in Decision 2
We have a single JSON Object with an “Array” in a String.
Here the [YES] is one of the possible results collected in Decision 1
If we had more it will be [YES, SOMETHING, WHATEVER]

Is this the best way to do this use case? or is there any other approach you would recommend?

Thanks.

From our description, the main intention is to combine both decision results. The end result of the decision should include the results from the common and the specific decision.

One option is using a decision literal expression to combine both results. The literal expression requires both decisions and combines the results, for example, by using a list function or a context.

concatenate(decision1, decision2)