Er3n
September 18, 2024, 8:58am
1
Hi everyone,
I’m struggling to get the following code for the column expression node right:
if (
column(“A”) - column(“A”, -1) < 0 // difference is smaller than 0 (negative)
&&
column(“B”) <> column(“B”, -1) // change in values between rows
)
{column(“C”)}
else {toNull(“”)}
Could anyone point out my mistakes?
Multi-row access is activated:
Thanks and best,
Eren
ArjenEX
September 18, 2024, 9:18am
2
Do you get a particular error message when trying to execute it?
1 Like
JPollet
September 18, 2024, 9:25am
3
Hi,
It seems to work with these modifications :
or
column("B") != column("B", -1)
Best,
Joel
4 Likes
var aCheck = column("A")-column("A",-1)
var bCheck = column("B")-column("B", -1)
if(
and(aCheck > 0, bCheck != 0)
) {
1
} else {
0
}
Debugged a little and can confirm: “not equal” operator must be “!=” and not “<>”
3 Likes
Er3n
September 19, 2024, 3:35am
5
@JPollet @MartinDDDD Thanks a lot for your quick help! Both your solutions work like a charm!!
@ArjenEX thanks for taking the time to ask. Unfortunately, I forgot to take a screenshot of the error message.
ps:
do you happen to know if there is any kind of resource where one can learn more about the coding syntax for KNIME nodes (Column Expression, Rule Engine, etc.)?
1 Like
No problem :).
Regarding documentation:
There’s a guide for the new knime expressions language used by Expressions Node (not Column Expressions):
https://docs.knime.com/latest/knime_expressions_guide/index.html#_introduction
For rule engine there are some good videos:
For column expressions you can in general use JavaScript on top of the pre-built functions.
3 Likes
Er3n
September 19, 2024, 7:42am
7
@MartinDDDD thanks a lot for the resources!!
1 Like
ScottF
September 19, 2024, 12:24pm
8
Hey look it’s @kowisoft !
2 Likes
system
Closed
September 26, 2024, 12:25pm
9
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.