i am currently trying to identify the last row of a table and change one value within one column.
I am trying this to set a flag in the column “last_row” as true. I need to identify each last row for one ID (already sorted by ID’s and set via viariable loop into seperate tables for each ID) to use later on only these last rows for my analysis (goal is to filter on the column last_row for true and false, as neede in the analysis).
I already searched within the forum and via google, but couln’d find any fitting answer.
A simple approach would be to use a Row Splitter node and separate the last row from the rest. You can then modify it and use a Concatenate node to concatenate it with the rest of table.
Is there a simple way to filter the last ‘n’ rows in the Row Filter / Row Splitter nodes?
It would be great if either the Include rows by number option for example allowed negative indices to mean ‘from the end’ (as they work in Python for e.g. string splicing etc) - I just tried it, and at the moment the node just silently converts a -ve start index to ‘1’ (without warning!)
@Boioing Why not use GroupBy node with aggregation Last on your original data set? This way you will have all last rows per ID. No need for variable loop, dividing data set into multiple data sets and flagging. If I got it right
@Vernalis This could be a useful feature. In the meantime sort it in opposite way and then filter normally