Rule engine - problem with data type

Dear all,

i have anohter weird problem:

my data set looks like this:

and i want to do the following:
check column by column from “subcutaneous” onwards if the value for the subcutaneous row is > 0
if it is > 0 the value shall be replaced with the value in the Count(Drug ID Number) column.

I do however not know what columns (formulations) i might have in a set and therefore hard coding all formulations (subcut., systemic ,…) in rule engine nodes will be a problem as the rule engine node would fail if the column isn’t existing.

Therefore i wanted to do it with a loop

the output after the transpose is:

and then loop it through the rule engine:
incoming data set into rule engine:

rule engine setting:

replace column is set to


that even flies but the replacement doesn’t really work…
it simply puts the values from the COunt column in all rows of the subcutaneous column

i therefore guess that the > “0” expression in the rule engine isn’t really doing the job, but i’m really stuck here at the moment …
any help greatly appreaciated

Hello @And_Z,

if I got it right you don’t need a loop nor Rule Engine node cause you can do it with one node in Math Formula (Multi Column). Use if() function, CURRENT_COLUMN placeholder with option to Replace Selected Columns. This expression should do it:

if($$CURRENT_COLUMN$$ > 0, $CountColumn$, 0)

Just make sure your count column is numeric in order to be available in Math Formula node(s). (Use String To Number node.)

As to why current setup is not working. You can not reference column values in Rule Engine with flow variable holding column name. See here for more and possible workarounds:



Hello @ipazin
that is indeed a straight forward and really elegant way to do it.
just tried it and it works really well.
many thanks for this and also for the fast reply, highly appreciate it


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.