Variables in a script for DMN-Input


#1

Hi,

so I know that it is possible to set variables in a Script-Task with the following statement:

execution.setVariable("name", variable);

Now I am wondering if it is also possible to declare variables in a script for a DMN-Table-Input:

dmn_var

I tried something like this to create a new variable in the script and use it as the Input Variable. But this does not work and always sets the value of the variable to null.

And using execution.setVariable or task.execution.setVariable is also not working at this place. Am I missing something or is it a desired behaviour, that no new variables can be used at this place.

Regards
Michael


#2

Hi @MichiDahm,

can you please provide the full example?
Where do you want to use the variable?

Best regards,
Philipp


#3

Hi @Philipp_Ossler,

let’s assume that we have the following process:

example1

In the first script-task we just create a new variable called “firstVariable” and set it as a process variable.

example2

Then in the next task we want to evaluate something with a decision table. I can set the input variable to “firstVariable” and in the input expression script I am able to work with the variable. This example works fine:

But if I want to create another variable in the input expression script, the decision table is not working anymore. In this picture I create a second variable in the input expression script and call it “secondVariable”. If I set the input variable for this column to my newly created variable, the decision table can not work with this variable:



Is there any way I can store/use new variables in an input expression script inside a DMN-table, or do these variables all have to be declared beforehand?

Regards,
Michael


#4

Hi Michael,

it is uncommon to set or create a new variable in an input expression. Input expressions are used to access a value or do a simple check or calculation (e.g. foo.bar, x == "foo", x * 0.1). The result of the input expression is assigned to the input value and can be accessed in the input entries.

Best regards,
Philipp