Produce a column that auto increments

I am currently limited with the use of version 4.0.1 so I cannot use the existing Add Auto Increment by bruno29a.

Is there any easy way to implement a similar solution (like in column 2 w/c is hardcoded currently)? Will the Math Formula node suffice? Since I will just be incrementing by 1 and use the last value from the previous row.

image

Hello @jchresp
Mi first comment is the data type. I guess this is a fast draft representing your challenge; lets assume your column is a numeric format instead displayed string; otherwise you would need to use String to Number node to convert it to Integer

You can use ‘GroupBy’ in your first table aiming to get the max value in $column2$ and send it to a variable. Then use this variable in your ‘Math Formula’ (integer check box) to update the values in 2nd table’s $column2$.

Math Formula
$$ROWINDEX$$ + $${SMax(column2)}$$ + 1

BR

2 Likes

Hi @gonhaddock,

I think your comment will be the next step to my problem.

Apologies on the incomplete context, but to give addt’l background…

>> I will be having a set of columns and I need to append the column containing the incremented numbers (in the image below, key):

image

So I was wondering how to produce those incrementing numbers (when I want to start at 0 or from any number)

Math Formula node summing up a differential. $$ROWINDEX$$ by itself will start from 0

$$ROWINDEX$$ + 1

BR

4 Likes

I think I can work with these. Much thanks!

2 Likes

Hi @jchresp

Two alternative options to those presented by @gonhaddock to calculate an incremental value based on previous row values are the nodes -Lag Column- node (the simplest) and -Moving Aggregation- node (the most powerful):

Hope this helps too.

Best
Ael

2 Likes

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