if then else with multiple conditions

Hi there

I am new to knime and try to migrate workflows from SPSS Modeler to KNIME. I stuck on applying a derived field:
How can I derive (create) a new variable by using if then else with multiple conditions on existing columns? Which nodes are best for the following example?

if (var1 > 0 and var2 > 0) or (var3 + var4 > 0) then 1 else 0 endif

I tried different nodes (column expression, rule engine, math formula) but wasn’t able to make it work.

Thanks for help or a hint.

Best regards, Sinan

For simple comparison rules you can use Rule Engine node. It will not allow you to sum up something, however - so you need to do your calculations prior to rule engine using Math node.

See syntax examples here JavaScript AND OR in IF Statement to Check For Multiple Conditions
Use Variable Expressions — NodePit
for variables or
Column Expressions — NodePit
for table cells.

Hello @sgknime,

and welcome to KNIME Community!

For Rule Engine if else logic see here:

For Column Expressions if else logic see here:

For Math Formula if else logic see here:

In your case I would go with Rule Engine :wink:

Br,
Ivan

Thank you very much to all of you for your answers and hints and links. After that I think it’s best to go with the rule engine. I can rewrite my logic though I was interested how such a simple comparison could be done 1:1 in KNIME.

Thanks again!
BR, Sinan