Syntax and Line Breaks

Hey all, KNIME newbie trying to transition from Alteryx to KNIME.

Is there a document anywhere that breaks down how Expression Syntax works in KNIME? Every time I need to write a formula/expression I find myself struggling.

Also, I am writing a Rule-Based Row Filter using an ‘IN’ expression. There are about 30 strings that need to be present for the IN. Rather than have on massive continuous line is it possible to do a line break to write each string on a separate line? I do this in VBA sometimes and was wondering if it it possible in KNIME.

I really appreciate any guidance on expression/formula writing!



the syntax of the Column Expressions and the Variable Expressions are based on a scripting language called JavaScript. Similar to the Math Formula and the String Manipulation nodes, the Column Expressions and Variable Expressions provide functions that can be used. To access the content of a column of the input table you simply call the function column(“COLUMN_NAME”) (or: column(column_index)).

Like in other programming languages, called functions are evaluated starting from the innermost, i.e. if you have an expression like


column(“a”) will be evaluated first and feeding its result (in this case the content of the column called “a”) into the function surrounding it. This way you can combine multiple functions to build a more complex one.
As these expressions get more and more complex and results of calculations may be re-used to feed different functions, you can store values into variables using



col_a = column(“a”)
res = sqrt(col_a)

Now you can re-use col_a and res in the lines to follow. The evaulation of an expression is always from top to bottom.
As the expression engine is based on JavaScript you can also use valid JavaScript syntax (but only up to ECMA 5). This means that you can also use for- and while-loops, if-else-statements and many more.



Hi there!

In addition to what has been said I would add that line break in Rule Engine nodes are not possible as each rule is either line or comment. In order to have each string in its own line you should do 30 rules.

Also considering you are in transition from Alteryx to KNIME I suggest you to check this forum topic:

And a bit older one:



Hi @TardisPilot, in case your Rule-Based Row Filter is structured like this:

$Column1$ = "Abc" AND $Column2$ = "Bcd" AND .... => TRUE

you could also consider

NOT $Column1$ = "Abc" => FALSE
NOT $Column2$ = "Bcd" => FALSE

Kind regards, agaunt

@moritz.heine, I really appreciate the breakdown!

1 Like

@ipazin, Thank you! I will check out those posts!

1 Like

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