Column Expressions IF function Error

Hi everyone,

I am fairly new to Knime and wondered if anyone could help with an error I keep getting in the column expressions node. The code is as below:

if((length(column(“Week”))==1), join(“0”, string(column(“Week”))), string(column(“Week”)))

When I evaluate this, the error I get is
Errors in code. Please fix the expression.
Expected ‘;’ but found 'end of expression. '
which is indicated to be found at the end of the IF function

And when I try to correct the error as it suggests by adding ; at end of the parenthesis, the evaluation become ? for all rows…

Seems like a simple function so I’m probably missing something obvious… if anyone could point me to the right way I would be really grateful!

Thanks in advance,

Lisa

There is no if() function. The expression needs to be
if (length(column(“Week”))==1) {join(“0”, string(column(“Week”)))}
else {string(column(“Week”))}

5 Likes

That solves the issue perfectly - thank you so much!

1 Like

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