SWITCH and structure IF-ELSE in Column Expression

Hey guys
I need some help with the logical structure in KNIME. I’m trying to change the record of two lines but on execution the change occurs in the entire record. I’m trying to use IF - ELSE and I also tried with CASE SWITCH, this one doesn’t change anything. Anyone who can help me please, thank you. One note is that the original file cannot be split into columns because the file has different structures. Follow the attachment. Thank you guys

Case.knwf (10.1 KB)

1 Like

Here’s an expression that worked for me in the Column Expressions node. It changes the first 2 rows:


    replace(column("Col0"), "|16122021|16122021|", "|16122021|30112021|")


It looks a little complicated since I nested quite a few functions, but the things to remember are:

  • the and function requires 2 or more arguments and returns a value of true or false
  • the or function also requires 2 or more arguments and returns a value of true or false
  • the contains function requires a string and a search term and returns a value of true or false


thanks @elsamuel for the help.

I’m new to KNIME and I’m learning to use the tool where here on the forum it’s been a place that helped me a lot and this is the second time I ask and receive help promptly.
I tried to make use of switch case because I have more similar cases where I need to change the second date field as highlighted in the picture.

But with your help you have attended me for the case I presented. Grateful.

1 Like