Does list contain another list

Hi. I am fighting FEEL expressions, trying to understand how to check if a list contains another list.

Example:

input1: requestedTypes [“B”, “C”]
input2: bookedTypes [“A”, “B”, “C”, “D”]
output: true/false

Please help me write a function to return ‘false’ if AT LEAST ONE value from bookedTypes equals to any value from requestedTypes.

Hi @V11,

Below feel expression can be used
some x in l1, y in l2 satisfies x = y

Notice: l1 and l2 represent the lists in our example

Kindly find attached a simplified dmn example
list_example.dmn (1.0 KB)

And below an evaluation call using Postman tool

1 Like

Kindly find below examples for some/every expressions

1 Like

Thx for your reply @hassang . It didn’t work for me, here is a bit more context.
I am using version 7 and my table has to have type String inputs, also I am using only DMN table, which I will call via Feign client from inside Java application and I will map Camunda’s response into an ebject that I will use later down the line. Attaching my table for reference and the error taht I’m getting.

Error: FEEL/SCALA-01008 Error while evaluating expression: failed to evaluate expression ‘some x in requested, y in booked satisfies x = y’: expect List but found ‘ValString([AAA])’

Request body used:
{
“variables”: {
“requested”: {
“value”: [“AAA”],
“type”: “String”
},
“booked”: {
“value”: [“AAA”],
“type”: “String”
}
}
}

My DMN table:
testing.dmn (1.9 KB)

Hi @V11,

If String inputs are used then your values are supposed to be separated by a separator as in the below example (# is used as separator):

{
    "variables": {
        "requested": {
            "value": "Hello#World",
            "type": "String"
        },
        "booked": {
            "value": "Hello#World#Test",
            "type": "String"
        }
    }
}

In your decision table, the below expression should be used for the output entry
some x in split(requested, "#"), y in split(booked, "#") satisfies x = y

And don’t forget to specify a value for the Output Name as in below
image

Kindly find attached the updated dmn
testing.dmn (2.0 KB)

1 Like

Sorry, maybe I was not clear. I need to use type string but I will actually going to pass an array.
So input example will be a List on Java side:

{
“variables”: {
“requested”: {
“value”: [“Hello”, “World”],
“type”: “String”
},
“booked”: {
“value”: [“Hello”, “World”, “Test”],
“type”: “String”
}
}
}

So type would be a string but array of strings will be passed.

This is what worked for me:
some x in requested satisfies list contains(booked, x)

Thank you! :slight_smile: