pentahokettlepentaho-spoonpentaho-data-integration

Get row number from stream to perform concat


Can we simply extract the row number from stream in Pentaho Spoon to perform a concat operation with it, for example?

Let's consider we have:

# Country RowNum
1 FR null
2 BE null

Here I want to extract the '#' column value, store it to the RowNum column to perform a concatenation. Another solution if it's possible, would be to extract the Row number directly in a Modified JavaScript value step to perform the concat operation.

The concat operation is : Country + str(RowNum)


Solution

  • There is a step named "Add Sequence" within a transformation which allows for this:

    enter image description here

    It will add per row a unique id. If you set it to start with 1 and to add 1 for each consecutive value, it will act as a rownumber.