Create IF expression in Knime

Help, I’m trying to create the following expression in knime using Math Formula

=IF([“COLUMN A”]=0, “COST”, “USAGE”)

image

Hope you can help,

Hi @Kikemx7

Since strings are involved, you’ll get the desired result with a Column Expression node using:

if (column("column1") == 0) {
    "COST"
} else {
    "USAGE"
}

1 Like

You could also try Rule engine node
br

Hi @Kikemx7 ,

What do you need at all? just set some information or say for which path I need to go?

Math Formula bring a huge possibilities if you need to calc something. If you need just validate and set a return, you can use rule engine node for it.

And after that, what you need to do? If you need to make decisions and change directions as “IF”, you need to set a value as “top” or “bottom” to use with “If start” node as flow variables.

If you need more options as a switch case, you need to set integer numbers and use it as flow to set the port to swtich case start node.

Well, I told some examples, but if you could bring some examples as workflow here, will be the best…

Regards,

Denis