kiedmnkogitofeel-language

Evaluate a list in a Kogito DMN decision table


I have a Kogito decision table that receives a structure as input with the following format:

input = { "name": "Karl", "favourite_colour": "blue" }

and returns a decision based on the colour.

The single value scenario that works

Now I need to change this and accept the following input structure:

input = { "name: "Karl", "fauvourite_colours": [ "blue", "red" ] }

I have been unable to get such a simple scenario working.

I tried defining this DMN:

the DMN diagram

and testing it with this .scesim file:

the test

where I define the input list as:

the list

My tests are failing as per the message below. I think the expression that I defined to evaluate the elements of the list is not defined properly.

org.drools.scenariosimulation.backend.runner.IndexedScenarioAssertionError: #2 Blue + Blue: Failed in "MultipleValues": The expected value is ""Everton"" but the actual one is ""Other"" (MultipleValueTest)

Any help much appreciated.


Solution

  • The problem in your second DMN decision table is that you didn't use the extended unary test, and the "extended" variant is needed since you want to apply an expression rather than a simple unary test.

    Try replacing with:

    every item in ? satisfies item = "blue"
    

    Where the ? is a placeholder of the "what is coming as input in the column".