How to use a list in DMN from the BPMN engine

There are several examples in the forum on how to work with lists in the DMN engine.
For example: How to create a input condition based on List as input

I need the average (mean) of a list of numeric values in DMN. In the BPMN engine I have a variable: listValues defined as ‘[10,30,60,50]’. Within DMN i call mean(listValues) but that doesn’t do the trick. I am not able to get the list contains examples from this forum working either.

What is the method to get the mean value from listValues variable within DMN engine?
I am using Camunda 7

Thanks!

Hi @Armando,

Which version of Camunda 7 do you use?
Which scripting language do you use?

If you want to use the mean, I would calculate it in the expression of an input column.
Then you can test against it in the cells of the respective column.

1 Like

Thank you for your response.
I am using Camunda 7.19.0.
In other examples, it was claimed that the type should be empty. Making it a string doesn’t change the result unfortuantly.
See the attached files for a minimal example. The proces runs and result variable stays empty.
Any help to get it working would be great.

test_list_avg.dmn (1.6 KB)
list_test.bpmn (3.6 KB)

Hi @Armando,

I changed the type to integer and invoked the table via REST — this worked flawlessly.
test_list_avg.dmn (1.6 KB)

Next, I tried to invoke the decision via the process. It did not work with the example that you provided. However, when I provided the list as a variable during startup, it worked perfectly:

1 Like

That works like a charm, thank you very much!

Is there a method, like execution.setVariable(), in which I can provide the json string to the BPMN engine from a groovy script?

If you execute a Groovy script you should be able to set a variable with a Groovy List (Java Array List) — no need for the JSON.