Can conditionals be used inside the then block of a FEEL/Literal expression in dmn

605 Views Asked by At

We are using Literal Expressions for one of our decisions.

Would like to see if coinditionals is supported inside the then ?

Returns with an invalid dmn

if(somecondition) then { if(newcondition) then {....} else {}

}else if (another condition) then {}

else {}

1

There are 1 best solutions below

0
On

Yes, conditionals can be used inside the then block of a FEEL/Literal expression in DMN.

The problem you are experiencing is that { } in FEEL is used to denote a context, while you possibly wanted to use () to parenthesise part of your expression.

In other words, you expression should be ~like:

if somecondition
then ( if (newcondition) then ... else ... )
else ( if (another condition) then ... else ... )

For example:

if a number > 0
then ( if modulo(a number, 2) = 0 then "pos even" else "pos odd" )
else "neg"

Demo:

demo nested conditional in DMN FEEL expression