DRD Collect and Contains

Hello,

I am trying to create a DRD with Camunda Modeler that has a couple DMNs that execute as dependencies. My first DMN is executing as a Collect, so that multiple rules can contribute to the output. The second DMN is trying to make a decision based on that collection using contains.

However, when I use FEEL: contains(input, “A”), I get an exception, something along the lines of:

Suppressed failure: illegal arguments: List(ValList(List(ValString(A), ValList(List(ValString(B))), ValString(A).

input is the output of the first DMN using COLLECT.

I have tried to use flatten in the second DMN: contains(flatten(input), “A”), but still get an error. However, if I use a LiteralExpression and flatten the output of the first DMN, then send that into the second DMN, the contains works! The extra literal expression seems unneeded if the contains(flatten(input), “A”) would work. Perhaps this is a bug?

Thanks

Hi @esnatera :wave:

Try to use the function list contains() instead of contains().

The result of a decision table with a COLLECT hit policy is a list. You need to use the function list contains() to check if an item is part of the list. The function contains() is only for string values.

Best regards,
Philipp

1 Like

Hey @esnatera and @Philipp_Ossler , I am attempting the exact same task but am not sure how to access the output of my first dmn which you guys have labeled “input” in this example.

The output of my first DMN is a collection, and has two fields “Name” and “Value” as shown below:
image

What variable can I use in my dependent dmn in the drd to access this collection?

Ah it looks like we cannot access each row of the collection as its own object when using a dmn output directy for another dmn input without the scope of a bpmn process. Can only collect a list of “Name” and a list of “Value” but does not look like we can get a list of objects, each object with a Name and Value field in a DRD.

Correct. In Camunda Platform 7, the output of the required decision is grouped by the output names. The variable with the output name is a list that contains all values of this output from the matched rules. See the docs.

The behavior is different in Camunda Platform 8. Here, the output of the required decision is one object that contains all outputs. In the case of a COLLECT hit policy, the output would the following structure:

[
  {"name": "a", "value": true},
  {"name": "b", "value": false},
]

See the docs.