Checking if a variable exists in DMN / JUEL

Hi!

Is it possible to check if a variable is available in JUEL expressions?

I tried empty myVar, but this also fails if the variable is not declared in the scope (I guess there is a difference between a variable explicitly set to null and one not declared at all).

I stumbled upon this having a boolean output variable that is not set under some conditions. When I use this output as required input for another decision, it fails.

Is there a way to check this with JUEL? Or alternatively with groovy/JS?

1 Like

you can use the javascript text using ‘empty’ in the input expression and in the input values you can use boolean checks to evaluate the given condition.2019-03-05_15h46_15

Can you give me an example of how what to actually put into the input field? I’m only getting errors with these checks.

Also, somehow this seems like a bug that variables that are not set do not evaluate to null, but produce an error. Is this intentional?

1 Like

Yes I am also wondering the same thing…

It’s OK if it’s intentional. The problem is Camunda documentation is silent about this.

Same here, not seem to work in DMN input expression. Have tried a few permutations and combinations

An example would definitely help.