DMN using List of String/Array

G’day, I’d like to know how to use DMN with list of strings or array in the input variable eg. A & B

{
“variables”: {
“name”: {
“value”: [
“A B”
],
“type”: “Array”
}
}
}

I need an output based on an array of input. So if A & B are present, I need an output

Here is an example using the FEEL function contains to check the content of your text.
Depending on your requirement you may want to adjust the rules and evaluation policy (First)

3 Likes

I tried your solution and found the problem
If I pass the variables value as folllows
{
“variables”: {
“myText”: {
“value”: “CA A HA”,
“type”: “String”
}
}
}

Then my result includes 3 values
“A”
“A”
“A”
I want evaluation just only “A” → “A”. Otherwise, “AB” or “HA” → is not satisfied.
How can I do it?

With “CA A HA” you should get only a result with one entry: “A”

With “CA B A HA” you will get a result containing three entries because all rules apply:
[{“Result”:“A”},{“Result”:“B”},{“Result”:“A and B”}]

If you want only a single value then you need to switch to a suitable hit policy:
https://docs.camunda.org/manual/latest/reference/dmn/decision-table/hit-policy/

1 Like

I try this solution, it worked for me

  1. Add list contains(code, “101”), list contains(code, “102”) to each row of decision table.

  2. Preparing request data as the following:

"code": {
            "value": ["101","102","103"]
 },

The result will shows all outputs which satisfy with input 101 and 102.
You can also test the solution using POSTMAN

Hope to help you!