moving values from one column to another based on a condition

Hello all,
Is there a way to do the following in knime:
if column A has the value “France” or “Germany” in it, then take the respective value in column B and put it in column C

I think this should be doable using column expression but not sure of the code


if (contains(column(“A”), “France”)||contains(column(“A”), “Germany”)) {column(“B”)}
else {column(“C”)}

This should conditionally replace Column C

The contains expression will replace column C with column B if France or Germany is contained anywhere within the text of that cell. If you just wanted to match the entire contents of the cell, then you can use

if (column(“A”)==“France”||column(“A”)==“Germany”) {column(“B”)}
else {column(“C”)}


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