Perform mathematical computation with string values

Column A Colum B Column C

Please how do this with KNIME

IF COLUMN A > 2*COLUMN B AND Column C = “Student”

The new Colum should be =“Great”

The above is an example

i tried using Rule Engine Node but Rule Engine can not perform mathematical computation.

Thank you

@ajisafeadeoye - assuming columns A and B have numbers (even though they are defined as strings) you could use the String Manipulation node to convert Columns A and B to Double (toDouble) and then do the calculations and the if-then statement inside a Columns Expressions node.

3 Likes

THANKS FOR YOUR RESPONSE

BOTH COLUMN ARE IN DOUBLE TYPE ALREADY. THE COLUMN EXPRESSION CAN NOT PERFORM IF CONDITION

@ajisafeadeoye you might want to try something like this?

if ((column("column A") > 2*column("column B")) && equals(column("column C"), "Student"))
{"Great"}
else if (1 == 2)
{"Not Great"}
else {"Something Else"}

kn_forum_71947_column_expression_double.knwf (8.7 KB)

2 Likes

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