Working on DMN table, need to know if FEEL supports “contains” functionality.
Also, would like to know if I can get the count of matches as one of the input column.
Tried to use JUEL expressions instead FEEL but not working. Any help will be appreciated.
I had referred to those related topics as well but didn’t work . Still get error as shown below
FEEL-01007 Unable to resolve function ‘contains’ in expression 'contains(CaseType,“BCNR”).
Also, I want to check if I can check against list of strings like (CaseType,“BCNR, RECALL”).Can I do this in one expression or need to add a separate rule for each String that I want to check. The list can grow big up to some 50 to 100 strings. any suggestions please.
For exact match, I was able to do but not for “contains”
the default FEEL engine doesn’t support a contains function. If you use the FEEL-Scala engine then you can write contains(CaseType,"BCNR"),contains(CaseType,"RECALL") (i.e. a disjunction) or matches(CaseType, <regex>) as condition of an input entry. Or you can write an expression like some type in ["BCNR","RECALL"] satisfies contains(CaseType,type)
However, if you want to check against 50 or more strings in a single expression then this expression will be neither readable nor maintainable. Maybe you can externalize the check or split it into multiple decisions / conditions.
sorry for reviving this old thread but I have exactly the same problem and can’t get it to work even though FEEL-Scala is now the default implementation used by Camunda DMN engine.
I have a decision table with an input parameter that contains a List of Strings, and I want to check if it contains a list of expected items.
So far, regardless of what I do, I always get this error: org.camunda.bpm.dmn.feel.impl.FeelException: FEEL/SCALA-01008 Error while evaluating expression: failed to evaluate expression '"true"': expected Boolean but found 'ValString(true)'
Let’s call the input value damageTypes, my expression (as entered in the DMN modeller) is: list contains(damageTypes,["car", "house"])
(according to FEEL-Scala docs, it’s “list contains” not “contains”, correct?)
I tried variations with just “contains” and with comparing to a single string, to no avail.
Any help would be greatly appreciated, thanks.
org.camunda.bpm.dmn.feel.impl.FeelException: FEEL/SCALA-01008 Error while evaluating expression: failed to evaluate expression '"true"': expected Boolean but found 'ValString(true)'
seems to indicate that something else is not correct.
Please share your decision table and the variables that you’re passing it
I’m afraid I cannot really post the code here since it’s company internal, but I just have 5 input parameters (2 boolean, 3 Strings), and only need to check a String parameter (passed as list) against a list of expected values.
Which expression is correct then? “list contains” or just “list”?
thanks @Philipp_Ossler, I tried to reproduce the error in a simple test table, but with all input parameter types I need to cover, including the list of Strings and the FEEL expression, but there everything worked as expected.
However for some reason, the DMN simulator won’t load it, but only show an empty inputs/outputs field and the demo tables; the remaining page is empty.
turns out the Enums I mapped with PropertyUtils are now Objects and my Enums name is UPPERCASE, but since toString() turns them lowercase, this was really hard to spot in the debugger…
Even inside the DecisionTable variable resolution, I could not spot uppercase names, almost magic;)
This works now, thanks still for all the input!
Sadly I cannot do a simple list check via [element], and I cannot check for sublist via list contains(inputParam, (["A"], ["B"])) , but have to combine two list containsviaand`.
In your case, the list contains() function should also work. Additionally, you can combine it with the count() function to check if the lists have the same size.
An equals check for lists will also be available soon: