User Tools

Site Tools


transformations:enumerate

ENUMERATE ROWS

Category: Transform / Basic


Description

This action adds a new column with row numbers. Rows can be enumerated: for the entire table, inside groups (combinations of values), and to a specified value.


Use cases

  • Create unique row IDs for datasets that do not already possess a unique key field.
  • To define an original record order with which to re-sort records downstream.
  • Prepare datasets for pivoting by setting a defined number of rows and row groupings (repetitions).


Action settings

SettingDescription
Enumerate in groupsSelect this option to restart row numbering at each unique value in the selected column(s).
Repeat after*Enter or set a maximum value after which the count resets to 1. Check the Add column with repetition count to
add a column (named "Repetition") that displays the count of the repetition.
Column listThis list appears when the Enumerate in groups is selected. Select which columns are taken into account to
form unique values when numbering columns. Column numbering will restart at 1 for each unique value or value
combination across all selected columns.

* Setting can be specified using a parameter.


Examples

Example #1

Enumerate all rows.

Before (source table)

Province City Amt Tax
ON Toronto 1000 125
ON Ottawa 1000 125
ON Brampton 2000 250
QC Montreal 2000 270
QC Quebec City 2000 270

After (result table)

RowNo Province City Amt Tax
1ON Toronto 1000 125
2ON Ottawa 1000 125
3ON Brampton 2000 250
4QC Montreal 2000 270
5QC Quebec City 2000 270

Action parameters

Default settings.


Example #2

Enumerate rows by Province.

Before (source table)

Province City Amt Tax
ON Toronto 1000 125
ON Ottawa 1000 125
ON Brampton 2000 250
QC Montreal 2000 270
QC Quebec City 2000 270

After (result table)

RowNo Province City Amt Tax
1ON Toronto 1000 125
2ON Ottawa 1000 125
3ON Brampton 2000 250
1QC Montreal 2000 270
2QC Quebec City 2000 270

Action parameters

Enumerate in groups
Columns: Province


Example #3

Enumerate all rows in sets of 2.

Before (source table)

Province City Amt Tax
ON Toronto 1000 125
ON Ottawa 1000 125
ON Brampton 2000 250
QC Montreal 2000 270
QC Quebec City 2000 270

After (result table)

RowNo Province City Amt Tax
1ON Toronto 1000 125
2ON Ottawa 1000 125
1ON Brampton 2000 250
2QC Montreal 2000 270
1QC Quebec City 2000 270

Action parameters

Repeat after: 2


Community examples


See also

transformations/enumerate.txt · Last modified: 2025/01/15 17:21 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki