How to make such a node from alteryx in knime?

Hi @divaice71 , rather than simply pasting a screen shot of an Alteryx expression, it would generally be better to tell us (in non-Alteryx terms) what it is that the Alteryx expression is doing, or at least what you are trying to achieve. You cannot assume that people on this forum can "read ‘Alteryx’ ".

It has been about 3 years or so since I last used Alteryx :wink:

I’m assuming that this expression means update the value of “X” as follows:

if  year of A = year of B  
    and month of A = month of B 
    and C = C(previous row value) 
    and D <> A 
then
    X + E (previous row value)
else
    X

which in Column Expressions could be written like this:

if (getYear(column("A")) == getYear(column("B"))
   && getMonthOfYear(column("A")) == getMonthOfYear(column("B")) 
   && column("C") == column("C", -1) 
   && column("D") != column("A") 
   )
{
      column("X") + column("E" , -1)  
}
else
{ 
      column("X") 
}

As has been mentioned, ensure you have set Window Size on the advanced tab so that it can collect previous row value (enable multi row access)

If the logic of my Alteryx translation is not quite right, then hopefully you can at least see how the syntax compares. Column Expressions is based on javascript, so you should be able to find general help with basic syntax on the web.

From what I can see of your formula, the value you are updating is not “self-referencing” from a previous updated value of the same column so this should suffice. If you need to write a Column Expression that can self-reference the previously updated/written value of the column it is updating, then see the following post “Column expressions have long memories too”:

4 Likes