String Flow Variable and Rule Engine

Hi everyone I am trying to to pass a String Input Flow Variable into the Rule Engine node but the string is not read as an expression by the Rule Engine Node.

While the expression complexity might not be an issue, is as follows: $A$>$B$ AND $C$<$D$ => “YES”

The following image is what I am trying to achieve

Flow Variable and Rule Engine.knwf (12.4 KB)

Many thanks and I also attaching the Workflow

Hi,

I think this is not possible to use flow variables inside the expressions like this (as the expression expects a boolean there not a string). but you can use them as a single expression. E.g.:
$A$>$B$ AND $C$<$D$ => “YES”

Which can be used in flow variables tab of the node to be assigned to each line of expression. This means for each condition you need one flow variable when using “Rule Engine” node. In this case you can use “Variable Expressions” node to create multiple flow variables which contain your conditions.

You could also use “Column expressions” in which you can have all of the conditions in one flow variable like this:
if(column("A") > column("B") && column("C") < column("D")) "YES"; else if (not(column("A") > column("B") && column("C")<column("D"))) "NO"

So in this case you can use a single flow variable to feed the node.

Another option which I guess is helpful in your case is using 2 rule engines. One to convert your conditions to boolean:
$A$>$B$ AND $C$<$D$ => TRUE
TRUE => FALSE

And the other one to apply them.
$OUTPUT$ => "YES".
NOT ($OUTPUT$) => "NO"

Here I have modified your workflow and used all the options above so that you can check them in practice:
Flow Variable and Rule Engine.knwf (29.1 KB)

Best,
Armin

4 Likes

Thank you very much, nice examples with several options.

Highly appreciated

Mau

1 Like