Alternative to Rule Engine (for If statements)


Just a quick question.

I need to make a rule involving multiple columns yet the rule engine seems to be throwing an error. What would be a good alternative?

If my first column (column 1) has a list of Countries


And my 2nd column (column 2) has the Sales amount


A rule in the rule node such as;

$column1$ LIKE “America” => $column2$ * 100

would throw an error.

Am I doing this wrong? Are there other alternatives?

Thanks for the help.


It supports Java style syntax.
if (…) {…}
else {…}

My Java is terrible.

Any chance the Python node will work for this? This is the option I’ve been exploring

Hi @Woodenfootspa and welcome to the KNIME community forum,

The Column Expressions node suggested by @izaychik63 is a Swiss Army knife. I suggest you take a look at this blog post which may be helpful to you:



Hi there @Woodenfootspa,

Rule Engine node does not support calculations. That why $column2$ * 100 won’t work and error is thrown. That is one of reasons Column Expressions node was introduced in KNIME. It is based on JavaScript syntax which is not that complex. Especially for simple IF statements and someone who knows Python :wink:

So IF statement would be something like this:


Considering your use case I would say you want to use Switch Statement. Link also provides good JS tutorial.

Alternatively you can use Rule Engine but only to output amount by which you need to multiply (100 from your example) and after that use Math Formula node to multiply two columns to get desired output. Python is one option as well but in this case I wouldn’t go that way.

Hope this clarifies things a bit.

Happy KNIMEing!



Thanks! This is perfect

1 Like

Hi there, I dont seem to have the Column Expressions node…

How do I install this? Thanks!

In KNIME menu go to Help/Install New software.
On the form Input Column Expression and choose in Work with drop-down --All available sites --. Then follow the wizard.

1 Like

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