Help with If syntax in Expression row filter

Long time Alteryx user here and very happy to find Knime. However, the learning curve is steep, even though I understand how to put together a workflow. I am having trouble resolving an error message I get using the Expression row filter. I have isolated a single field of data (~1200 rows) from a larger Excel spreadsheet that looks like this:

A1.B1.C2.D5.E3

A1.B1.C2.D5.E3S

I have one expression filter that isolates lines containing “S” successfully, but I also want to extract the row immediately prior that has the same string without the “S”. “S” is a flag for a spouse who has married into the family in a genealogy tree. I am using the following If statement in an expression row filter, but it throws the error “In function ‘if’: All branch expressions must have the same type”. This is the expression: if(contains($[“GeneaID”],“S”),$[“GeneaID”,-1],TRUE). I can’t find any documentation on the correct syntax that would resolve the error message. Can anyone help me with it?

Use the Expression node.

1 Like

That worked. Thank you!

You’re welcome. Please mark solved.

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