pentahopentaho-spoonpentaho-data-integration

Generate consecutive rows in Pentaho


How do I generate consecutive rows in Pentaho Spoon?

I have a text file and I am using "Sample Rows" step to select every third line from the text file. But the problem with the "Sample Rows" is that I have to manually type "3,6,9,12....".

I tried adding the field name from "Add Sequence" step, but it doesn't read.

Attached Image


Solution

  • You can add a counter using the Add Sequence step and setting the Maximim value as 3.

    This will create a new field, integer, with values 1,2,3,1,2,3,...

    Then, a Filter Rows step can be used on the condition that the field must equal 3, and only every 3rd row will pass to the output of the filter rows step.