How to Implement String.contains method in DMN table

Hi Camunda team,

I am very new to camunda…

I need to create a DMN table with word string matching capability. Something like String.contains() method. Is it possible to implement this as input in DMN.

example:
input == “iminINDIA”, input.stringcontains(“INDIA”); then return “INDIA”.

Can the above be implemented via DMN table.

Yes, you can switch the input entry to JUEL and use Java method calls like email.contains("camunda.com")

Or you can try the new feel-scala community extension.

Hope this helps, Ingo

Hi @Bhavya,

when you use the FEEL-Scala extension (e.g., via factory) then you can write contains(input,"INDIA") for input entry. See the example: feelContainsFunction.dmn (920 Bytes)

Best regards,
Philipp

Hi Philipp_Ossler,

Do we need to any plugin to evaluate above DMN (feelContainsFunction.dmn) ?
I have tried downloading the above dmn, deploy and run but it throws error while evaluating.

Thanks,
Manish

Hi @manish_kumar,

since Camunda 7.13, the FEEL engine is included. So, you can use the contains() function without any further plugin.

Check if the variables are set correctly. If it doesn’t work then please share the failure message.

Best regards,
Philipp

1 Like

Hi @Philipp_Ossler, i tried the approach mentioned by you, it works perfectly fine when the input string is not null, but it evaluates true even when input string is null. can you guide on how to use contains when input is null?

You can handle null values explicitly by comparing the input with null.

Please share your example if it is not clear yet.

i want to see if we can do null comparison and contains comparison by using one condition only. Anyhow, thanks for your response, i already solved this by using like this:
input!=null and contains(input,“INDIA”)

1 Like