sample bottom n rows


When a table is within a loop with dynamic number of rows per iteration, how can one sample the last n rows using the row filter or row sampling?


It would be nice to have a select  fixed number from bottom option.

thanks in advance.

You can compute the RowRangeStart option with a Java Edit Variable for example. Something like this:

return Math.max(0, numberOfRows -n -1); //you have to keep numberOfRows as a flow variable
//Extract Table Dimension can help find this value, it also puts to the flow variable with the name Number Rows.

Not wanting to use Java or some Snippet myself,

you could use the Math Formula node with the formula "RowCount - n", where n is the number of last rows you want to collect. Then use the TableRow to Variable node and connect this to the Row Filter or Row Sampling node. Then simply choose the "Include Rows by Number", and "Include to End of Table", then go to the flow variables tab and select the variable we created from the dropdown next to RowRangeStart.

Hope this helps from a Snippetophobe.


Thanks for both solutions. I am partial to the second . Works! fantastic. Would be nice to avoid this round about way tho. if an option could simply be included in the row sampling.


thanks again!