FEEL: test based on field in list item

Hi everybody,

I’m currently trying to create a rule based on a list input. I already found this discussion Is it possible to do array Input? but I cannot find the right expression.

My input looks like this:

 name: "someName",
attribute: {
other: "stuff",
packaging: [
{ name: "attribute", value: "value1"}
{name: "attribute2", value: "value2"}

Now I want my rule to work based on the value. My input expression is data.attribute.packaging and then I tried this rule: some package in cellInput satisfies (package.unit = “Palette”). Unfortnately, I get the error

org.camunda.bpm.dmn.feel.impl.FeelException: failed to evaluate expression ’ some package in cellInput satisfies (package.unit = “Palette”)’:
expect List but found 'ValString

I already use the Feel Scala extension. I hope you can help me.


1 Like

Hi @rbraeunlich,

please share your complete example, including your DMN file. Do you have a Github repository for the test case?

It sounds like the input expression is evaluated to a string. Maybe, the data type is set to string? Try to set it to list.

Best regards,

Hi @Philipp_Ossler

you saved my day :slight_smile: Using typeRef=list solved this. I didn’t know about this input type because bpmn.io doesn’t show it. Thank you!


Currently, there is no input type registered for list. So, the DMN engine doesn’t transform the value from the input expression - it is just ignored :sweat_smile:

That sounds like black DMN magic :wink: As long as it works I don’t mind.

One additional question @Philipp_Ossler:
Can I return the value that matched my condition somehow? So if I have an output column that’s just supposed to return the value that was the input, how can I achieve this with a list?

Do you mean that you want to return the item of the list (i.e. package where the unit is “Palette”)?

This is not possible. The output entry has no context from the input entries or the input expression.

You could get the item with an expression. For example:

data.attribute.packaging[unit = "Palette"][1]

(filter the list and take the first item)

Hey @Philipp_Ossler
is this a JUEL expression? And shouldn’t the index be zero based?
Somehow, I only get DMN-01002 Unable to evaluate expression for language 'juel': '${data.attribute.packaging[unit = "Palette"][0]}'

Just as an update, one problem was the single equals. It seems like it has to be ==. But now I get Cannot resolve identifier 'unit'

No, this was meant as FEEL expression :wink:

Okay, but FEEL looks even worse :smiley:

[1.55] failure: `or' expected but `[' found

data.attribute.packagingUnitMetTd[unit = "m²/Palette"][1]

When I remove the [1] I get this exception:

java.lang.IllegalArgumentException: unexpected val 'ValContext(ObjectContext(com.my.package.MyClass@20312893,org.camunda.feel.integration.CamundaValueMapper@12dae582))'

Hmm. A grammar limitation. Try to add some parentheses: (data.attribute.packaging[unit = "Palette"])[1]

1 Like

Thank you @Philipp_Ossler! This solves my problem and the DMN works.
Also kudos for creating that FEEL engine!