User Tools

Site Tools


transformations:addcolumn

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
Next revisionBoth sides next revision
transformations:addcolumn [2021/03/30 23:07] craigttransformations:addcolumn [2023/11/24 19:16] – [Examples] craigt
Line 6: Line 6:
 =====Description===== =====Description=====
 This action calculates one or more new columns using [[syntax:start|expression(s)]]. One expression creates one column. This action calculates one or more new columns using [[syntax:start|expression(s)]]. One expression creates one column.
- 
-The expression is calculated for every row. Other column values in the same row can be referred to by column names in square brackets. It's not possible to refer from one row to another row or to another table. 
- 
-Instead of an expression, this action can insert a full column of static text or numeric values.\\ 
  
  
Line 26: Line 22:
 |Position|Choose where the new column(s) will appear in the dataset.  Options:  //Rightmost//, //Leftmost//, or //After column//\\ (and select the column the new column(s) will appear after).| |Position|Choose where the new column(s) will appear in the dataset.  Options:  //Rightmost//, //Leftmost//, or //After column//\\ (and select the column the new column(s) will appear after).|
  
 +\\ 
 +=====Remarks=====
 +The expression is calculated for every row. Other column values in the same row can be referred to by column names in square brackets. It's not possible to refer to other rows or tables.
 +
 +Instead of an expression, this action can insert a full column of static text or numeric values.\\
 +
 +Subsequent expressions can reference columns previously created within the same //Calculate new column(s)// action.  (See example, below)
 \\  \\ 
 =====Examples===== =====Examples=====
Line 38: Line 41:
 | Switzerland  |  53716|  48414|  9.87%| | Switzerland  |  53716|  48414|  9.87%|
 | Canada  |  45896|  37469|  18.36%| | Canada  |  45896|  37469|  18.36%|
 +\\ 
 **Action parameters:** **Action parameters:**
 > New column name: Deductions $ > New column name: Deductions $
 > Expression: [Gross income] - [Disposable income] > Expression: [Gross income] - [Disposable income]
  
- +\\  
-**Output table:**+**Result table:**
  
 ^Country  ^Gross income   ^Disposable income  ^Compulsory deductions  ^Deductions $  ^ ^Country  ^Gross income   ^Disposable income  ^Compulsory deductions  ^Deductions $  ^
Line 52: Line 55:
 | Canada  |  45896|  37469|  18.36%|  8427| | Canada  |  45896|  37469|  18.36%|  8427|
  
 +\\ \\ \\ 
 +**Example:** Create multiple new columns within the same action.
  
 +\\ 
 +**Action parameters:**
 +> New column #1: MyDate = today()
 +> New column #2: MyYear = year([MyDate]) //(References the [MyDate] column previously created in this action.)//
 +
 +
 +
 +\\ 
 +====Community examples====
 +  * [[https://community.easymorph.com/t//1273/6|Split Excel spreadsheets into multiple spreadsheets]] ([[https://community.easymorph.com/uploads/short-url/6iWYdZJc4yAvqYMbTGZWXtVFmvL.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Spreadsheet A.xlsx//;\\ Action position: //3//)
 +  * [[https://community.easymorph.com/t//1283/2|How to split Number and Alphabetical Characters from a Cell]] ([[https://community.easymorph.com/uploads/short-url/wzaamfKXHrZWs690Lc5akE2OWsV.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Table 1//; Action position: //2//)
 +  * [[https://community.easymorph.com/t//1489/1|How to calculate YoY change using self-join]] ([[https://community.easymorph.com/uploads/short-url/n3koKAS8IXLsc5Oa9647ELLijkp.morph|Project]]; Module: //Main//; Group: //Self-join//; Table: //This year//; Action position: //4//)
 +  * [[https://community.easymorph.com/t//1587/7|How to format the duration in more than 24h]] ([[https://community.easymorph.com/uploads/short-url/w6CnxwiidYjcJHNRrmUIXI74NC2.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Table 1//; Action position: //6//)
 +  * [[https://community.easymorph.com/t//1919/2|Split after last space]] ([[https://community.easymorph.com/uploads/short-url/obnKd1zEnmJ9NkAEx53ho7sz9Gw.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Table 1//; Action position: //2//)
 +  * [[https://community.easymorph.com/t//2060/2|Search, remove, and shift]] ([[https://community.easymorph.com/uploads/short-url/cCqOTak9SLKPXbityR5IAlgULJa.morph|Project]]; Module: //Main//; Group: //Regrouping//; Table: //ExtractingData.xlsx//; Action position: //5//)
 +  * [[https://community.easymorph.com/t//2488/2|Split text into columns problem - split when data changes from text to numbers]] ([[https://community.easymorph.com/uploads/short-url/fKwR2v9mZiSQ6cXclMb446ittht.morph|Project]]; Module: //Main//; Group: //Group 1//;\\ Table: //Variant 1//; Action position: //2//)
  
 \\  \\ 
Line 60: Line 81:
   *Click the drop-down arrow in a column heading and select "Insert column(s)".   *Click the drop-down arrow in a column heading and select "Insert column(s)".
 In either case, a new column with a default column name will appear //after// the selected column. In either case, a new column with a default column name will appear //after// the selected column.
- 
- 
  
 \\  \\ 
 =====See also===== =====See also=====
-  * [[transformations:replacecolumn|Modify column(s)]]+  * [[transformations:replacecolumns|Modify column(s)]]
   * [[transformations:Peek|Peek]]   * [[transformations:Peek|Peek]]
   * [[transformations:rule|Rule]]   * [[transformations:rule|Rule]]
   * [[transformations:subtotal|Total/Subtotals]]   * [[transformations:subtotal|Total/Subtotals]]
  
transformations/addcolumn.txt · Last modified: 2024/02/05 14:20 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki