FEEL- contains method in DMN

Hi I have this scnerio in DMN where my input variable is list of strings. List.

I am trying to have a rule where category is a list of string say for example. [“C1”, “C2”, “C3”] and i want to match if catogory contains “C1” then out put should be “Valid”

Hi @V11,

Below expression can be used

some x in l1 satisfies x = "C1"

Notice: l1 represent the list

1 Like

Here is a more advanced example

Thanks Hassang,

I also tried for
contains(category, “C1”). [where category is list of string]

Its working. is there any drawback for this expression?

1 Like

Hi @Prachi

Actually the function you used is more convenient for your case :+1:

One note

It looks like your input is of String type. That is why you use
contains(category, "C1")

If it were a list then you are supposed to use something similar to below

list contains(category, "C1")

1 Like

I believe that using String type is a kind of problematic in this case.

For example:
If you have a list as below
ls = [“34”, “45”, “44”]

contains(ls, “4”) will return true even that no element is equivalent to 4

1 Like

Agree with this. my “category” type is a list actually. it can have values like [“C1”, “C2”] or [“C5”, “C2”, “C3”]
need to try as list contains(category, “C1”) then.

Thanks a lot Hassang