Feel Access an arrayList of objects

Dear community,

I really got stuck, when I’m trying to evaluate a variable containing a list of objects in a DMN with feel expression language.

The variable called “cars” is a type of java.util.ArrayList. The deserialized value is formed like this:

[
{“value”:“bmw”,“label”:“BMW”},
{“value”:“ford”,“label”:“Ford”},
{“value”:“vw”,“label”:“VW”}
]

In the Modeler I setup the expression like this
image

and add the expression: list contains(value, “bmw”)

From the Camunda API I retrieve an error

type: ‘StringIndexOutOfBoundsException’,
message: ‘start 0, end -2, length 0’,

Does somebody have an idea what I’m doing wrong?

Thanks for your help

Michael

Hi @michael1. :wave:

It seems that the data types don’t match.

If you pass the list of cars as the input expression then you need to access the “value” property in the input entry. For example:

list contains(?.value, "bmw")

Or, you change the input expression to

cars.value

and the input entry to

list contains(?, "bmw")

Does this help you?

1 Like

Hi Philipp,

thanks for your help! I was able to get it running. Stupidly I did not select “Asynchronous Before” on the next service task. So the token passed all the time my DNM and returned the failure from the task afterwards.
Nevertheless, the DMN output was not all the time as expected.
To get the good results my expression is now:

list contains(cars.value, “bmw”)

and in the Modeler I set following attributes:

image

I hope that will help others struggling like me.

Best regards

Michael

1 Like