transformations:enumerate
This is an old revision of the document!
Table of Contents
ENUMERATE ROWS
Category: Transform / Basic
Description
This action adds a new column with row numbers. Rows can be enumerated for either the entire table or inside groups defined by combinations of values in particular columns. In the latter case, row numbers restart from 1 inside each group.
Use cases
- Create unique row IDs for datasets that do not already possess a unique key field.
- To define an original record order to re-sort records by downstream.
Action settings
Setting | Description |
---|---|
Enumerate in groups | Select this option to restart row numbering at each unique value in the selected column(s). |
Column list | This 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. |
Examples
Source table:
Province | City | Amount | Total Tax |
---|---|---|---|
ON | Toronto | 1000 | 125 |
ON | Ottawa | 1000 | 125 |
ON | Brampton | 2000 | 250 |
QC | Montreal | 2000 | 270 |
QC | Quebec City | 2000 | 270 |
After transformation (enumeration for entire table).
RowNo | Province | City | Amount | Total Tax |
---|---|---|---|---|
1 | ON | Toronto | 1000 | 125 |
2 | ON | Ottawa | 1000 | 125 |
3 | ON | Brampton | 2000 | 250 |
4 | QC | Montreal | 2000 | 270 |
5 | QC | Quebec City | 2000 | 270 |
After transformation (enumeration for each Province).
RowNo | Province | City | Amount | Total Tax |
---|---|---|---|---|
1 | ON | Toronto | 1000 | 125 |
2 | ON | Ottawa | 1000 | 125 |
3 | ON | Brampton | 2000 | 250 |
1 | QC | Montreal | 2000 | 270 |
2 | QC | Quebec City | 2000 | 270 |
After transformation (enumeration for each Province-Amount pairing).
RowNo | Province | City | Amount | Total Tax |
---|---|---|---|---|
1 | ON | Toronto | 1000 | 125 |
2 | ON | Ottawa | 1000 | 125 |
1 | ON | Brampton | 2000 | 250 |
1 | QC | Montreal | 2000 | 270 |
2 | QC | Quebec City | 2000 | 270 |
Community examples
- String manipulation (REVERSE) (Project; Module: Main; Group: Tab 1; Table: Using actions; Action position: 4)
- How to order columns by a list of columns (Project; Module: Main; Group: Tab 1; Table: Reordered columns; Action position: 2)
- Update existing data in a database table (Project; Module: Main; Group: Tab 1; Table: Sample data; Action position: 4)
- Iterate through a set of column (Project; Module: Main; Group: Tab 1; Table: in.csv; Action position: 2)
- .txt to .csv - Multiple Line & Character Length HELP! (Project; Module: Main; Group: Group 1; Table: SAMPLE.txt; Action position: 4)
See also
transformations/enumerate.1626673486.txt.gz · Last modified: 2021/07/19 01:44 by craigt