Feature Request: Generic IF ELSE No/Low Code Solution

Dear KNIMErs,

At work, I often get confronted with a particular statement from my colleagues: “I love KNIME and it helped me alot in automizing my tasks, learn more about my data and so on. But why is there no native way to implement an IF / ELSE statement?”

I know about the JS based Column Expressions, or the Math Formula that can perform numeric IF / ELSE scenarios. But it would be very cool to have it as a seperate node, or inside an rule engine or so where no JS is needed.

This would also prevent other statements such as “Why not code in the first place, if one needs JS anyhow?”, or “But Alteryx…” (no offense).

Is there something like this planned to make this more “low code friendly”? :slight_smile:

Hi @Residentstiefel

that is actually the idea of the Rule Engine nodes.
Did your colleagues ever tried using it? The syntax is slightly different to a super simple IF Else Statement.

Instead of writing IF condition1 => Output ELSE => Fehler
You write Condition1 => Output
TRUE => Fehler

The True in this case is your else case. You can have also multiple ifs, as the node will always go through them one by one. Hence the second line is the first else if.

Is this helpful?


Hi Iris,

Thanks for the reply! :slight_smile:

We all love the rule engine of course, but if you want to do for example a mathematical operation based on a condition, that wouldn’t work in the rule engine, right? (My apologies, I wasn’t clear enough in the post).

This is possible in the math formula, however, only if the condition involves numeric columns. Else one could use the column expressions, but then a user must know JavaScript basics (maybe basics is too much here, nevertheless some users might get stuck here, i.e. we experienced that as well in our department).

Hence, an easier way to handle IF/ELSE statements with some succeeding data operations would be much appreciated. However, maybe I am also missing something here, that this already exists?

1 Like

Dear @Residentstiefel,

This is possible in the math formula, however, only if the condition involves numeric columns.

I just want to suggest using the Rule Engine to create a numerical column (containing, for example, 0s and 1s) on which you can execute the IF-function in a subsequent Math node.

The Rule Engine and the Math node alone do not solve your problem, but together they do :slightly_smiling_face:

You can also use a Row Splitter - (insert custom operation here) - Concatenate sequence to emulate an IF/ELSE statement.

Table too large for this? Then maybe this is a possible solution:

(If someone has a solution that avoids using an index column, I am all ears/eyes)



Hi @Aswin,

Thanks for the idea :slight_smile: I especially like the approach for big data tables and the chunk loop! That is very helpful, also for other use cases.

Nonetheless, your example shows how creative a user must get to tackle a rather simple problem. In my opinion, this is a missing generic, but powerful feature/node in KNIME, especially if it would be possible to use the simple low code syntax from rule engine, math formula and maybe even string manipulation, to do various operations after an IF ELSE Statement.


1 Like

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