User Tools

Site Tools


transformations:enumerate

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
transformations:enumerate [2019/11/19 07:35] – added grouping dmitrytransformations:enumerate [2025/01/15 17:21] (current) craigt
Line 1: Line 1:
-===== Enumerate rows =====+{{ transformations:EnumerateRowsAction.png}} 
 +====== ENUMERATE ROWS ====== 
 +Category: Transform / Basic\\
  
-This transformation adds a new column with row numbers. Rows can be enumerated either for the entire table, or inside groups defined by combinations of values in particular columns. In the latter caserow numbers restart from 1 inside each group.+\\  
 +=====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.\\
  
-**Example**+\\ 
 +=====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).
  
-Before transformation +\\  
-^Province  ^Amount  ^Total Tax  +=====Action settings===== 
- ON   1000| 125+^Setting^Description
- ON  | 1500|  187.5+|Enumerate in groups|Select this option to restart row numbering at each unique value in the selected column(s). 
-|  QC      2000| 270|+|Repeat after<sup>*</sup>|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 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.| 
 +<sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\
  
-After transformation (enumeration for entire table). +\\  
-^RowNo ^Province  ^Amount  ^Total Tax  ^ +=====Examples===== 
-|  1|  ON  | 1000|   125| + 
-|  2|  ON  | 1500|  187.5+====Example #1==== 
-|  3|  QC  |     2000| 270|+>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 
 +|  **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| 
 + 
 +===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  ^ 
 +|  **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| 
 + 
 +===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  ^ 
 +|  **1**|ON  |Toronto  | 1000|  125| 
 +|  **2**|ON  |Ottawa  | 1000|  125| 
 +|  **1**|ON  |Brampton  |  2000|  250| 
 +|  **2**|QC  |Montreal  |  2000|  270| 
 +|  **1**|QC  |Quebec City  |  2000|  270| 
 + 
 +===Action parameters=== 
 +>Repeat after: 2 
 + 
 +\\  
 +=====Community examples===== 
 +  * [[https://community.easymorph.com/t//1332/3|String manipulation (REVERSE)]] ([[https://community.easymorph.com/uploads/short-url/67c52KIJt323kknw2Q4vOvlAJ05.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Using actions//; Action position: //4//) 
 +  * [[https://community.easymorph.com/t//1351/1|How to order columns by a list of columns]] ([[https://community.easymorph.com/uploads/short-url/bKeuXUgwKo1alDrA03LY5z3tPJv.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Reordered columns//; Action position: //2//) 
 +  * [[https://community.easymorph.com/t//1649/14|Update existing data in a database table]] ([[https://community.easymorph.com/uploads/short-url/hauw3ZALjf9UqXAOP8prtLUNbxH.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Sample data//; Action position: //4//) 
 +  * [[https://community.easymorph.com/t//1849/4|Iterate through a set of column]] ([[https://community.easymorph.com/uploads/short-url/5icrGfTGgzbmG2l5AuSiqb43QvR.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //in.csv//; Action position: //2//) 
 +  * [[https://community.easymorph.com/t//2454/4|.txt to .csv - Multiple Line & Character Length HELP!]] ([[https://community.easymorph.com/uploads/short-url/m3PqCDwhBrNEG2xW23QqEvl8RbX.morph|Project]]; Module: //Main//; Group: //Group 1//; Table: //SAMPLE.txt//; Action position: //4//) 
 + 
 +\\  
 +=====See also===== 
 +  *[[transformations:enumerategroups|Enumerate groups]] 
 +  *[[transformations:sequence|Sequence]]
  
-After transformation (enumeration for each Province). 
-^RowNo ^Province  ^Amount  ^Total Tax  ^ 
-|  1|  ON  | 1000| 125| 
-|  2|  ON  | 1500| 187.5| 
-|  1|  QC  |    2000| 270| 
transformations/enumerate.1574166951.txt.gz · Last modified: 2019/11/19 07:35 by dmitry

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki