# column expression or rule engine node

Dear all,

I have this excel expression =IF(Y3=4;IF(AND(X3>50;O3=J3);1;IF(AND(W3>50;N3=J3);1;0));R3) and I want to “translate” the same expression into the rule engine or column expression node:

Since I have 2 TRUE statements I don´t know how to write the correct statement in the rule engine node:

\$Count*(Eliminieren Ausreißer von MW)\$ = 4 AND \$Anteil MinPreis an OP-Preisen\$ > 50 AND \$Online_Price (Min*)\$ = \$Online_Price\$ OR \$Anteil MaxPreis an OP-Preisen\$ > 50 AND \$Online_Price (Max*)\$ = \$Online_Price\$ =>1
TRUE=> 0

TRUE=> \$Eliminieren Ausreißer von MW\$

Note:

R3 ≙ \$Eliminieren Ausreißer von MW\$

Furthermore, I´ve tried this in the column expression with no success:

if(column(“Count*(Eliminieren Ausreißer von MW)”)) == 4 AND column(“Anteil MinPreis an OP-Preisen”) > 50 AND column(“Online_Price (Min*)”) == column(“Online_Price”) OR column(“Anteil MaxPreis an OP-Preisen”) >50 AND column(“Online_Price (Max*)”) ==column(“Online_Price”)

{1}

else if {0}

else column(“Eliminieren Ausreißer von MW”))

Correction for the expression in the nodes or any other solutions are welcome.

Hi @Ashina,
At first glance the problem in your expression for the Column Expression node is that there you do not use AND and OR but && and || respectively instead. That’s because the Column Expression node is essentially a JavaScript engine. But no worries, we are currently working on unifying the different expressions in KNIME!
Kind regards,
Alexander

1 Like

To add: `else if {0}` is also not valid since the actual if statement is missing.

1 Like

Hi Alexander,

do you know how I could correct the column expression? Right now I am working with a workaround solution:

Rule based row splitter

\$Count*(Eliminieren Ausreißer von MW)\$ = 4 => TRUE

Rule engine

\$Anteil MinPreis an OP-Preisen\$ > 50 AND \$Online_Price (Min*)\$ = \$Online_Price\$ OR \$Anteil MaxPreis an OP-Preisen\$ > 50 AND \$Online_Price (Max*)\$ = \$Online_Price\$ =>1

TRUE => 0

Rule engine

TRUE=> \$Eliminieren Ausreißer von MW\$

Concenate

Column expression

if(isMissing(column(“FINAL für Mittelwert-Preis 0=eliminieren”)))

column(“splitt2_Final”);

else column(“FINAL für Mittelwert-Preis 0=eliminieren”);

Hi Arjen,

do you know how the correct Column expression should be expressed? Right now I am working with a workaround solution:

Rule based row splitter

\$Count*(Eliminieren Ausreißer von MW)\$ = 4 => TRUE

Rule engine

\$Anteil MinPreis an OP-Preisen\$ > 50 AND \$Online_Price (Min*)\$ = \$Online_Price\$ OR \$Anteil MaxPreis an OP-Preisen\$ > 50 AND \$Online_Price (Max*)\$ = \$Online_Price\$ =>1

TRUE => 0

Rule engine

TRUE=> \$Eliminieren Ausreißer von MW\$

Concenate

Column expression

if(isMissing(column(“FINAL für Mittelwert-Preis 0=eliminieren”)))

column(“splitt2_Final”);

else column(“FINAL für Mittelwert-Preis 0=eliminieren”);

Hi @Ashina,
If you could share your workflow (maybe with dummy data), we might be able to help trim it down a bit. But with this text format it is a bit difficult to grasp
Alexander

2 Likes

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