Row Number
About Row Number
This operation creates a new column containing the row number, starting from 1, for each input file.
- The header row is excluded from the count
- The first row number is 1
- The row number is captured at the point the operation is used in the pipeline
Using the Row Number operation
To add a Row Number operation to your pipeline, open the ‘Add Operation’ popup and select ‘Row Number’. By default the new column is named ‘Row Number’. Type in the field to change the column name. If the new column name already exists, the other column will be overwritten.
Example
Add a column containing the row number to dataset.
Company |
Value |
Row Number |
|---|---|---|
Acme |
145 |
1 |
BetaCorp |
456 |
2 |
InsureCo |
532 |
3 |
NewCo |
235 |
4 |
XYZ Industries |
234 |
5 |
Differences with the addRank script
The addRank script is a legacy method for adding the row number.
- addRank starts counting at 0.
- addRank numbers each row input to the stage, regardless of the point at which the operation is defined within that stage.
- addRank creates a column called ‘Rank’. Changing the name requires a subsequent operation.
We recommend using the Row Number operation for all new pipeline builds and converting addRank operations to Row Number operations wherever possible, since addRank will be deprecated in future.