transformations:addcolumn
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
transformations:addcolumn [2021/03/30 23:07] – craigt | transformations:addcolumn [2024/02/05 14:20] (current) – craigt | ||
---|---|---|---|
Line 6: | Line 6: | ||
=====Description===== | =====Description===== | ||
This action calculates one or more new columns using [[syntax: | This action calculates one or more new columns using [[syntax: | ||
- | |||
- | 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 25: | Line 21: | ||
|Expression or Value|Options: | |Expression or Value|Options: | ||
|Position|Choose where the new column(s) will appear in the dataset. | |Position|Choose where the new column(s) will appear in the dataset. | ||
+ | |If column already exists|Choose how EasyMorph reacts if the new column name already exists in the dataset.\\ | ||
+ | |||
+ | \\ | ||
+ | =====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. | ||
+ | |||
\\ | \\ | ||
=====Examples===== | =====Examples===== | ||
- | **Example: | + | **Example |
**Source table:** Average income and deductions | **Source table:** Average income and deductions | ||
Line 38: | Line 44: | ||
| Switzerland | | Switzerland | ||
| Canada | | Canada | ||
+ | \\ | ||
**Action parameters: | **Action parameters: | ||
> New column name: Deductions $ | > New column name: Deductions $ | ||
> Expression: [Gross income] - [Disposable income] | > Expression: [Gross income] - [Disposable income] | ||
- | + | \\ | |
- | **Output | + | **Result |
^Country | ^Country | ||
Line 52: | Line 58: | ||
| Canada | | Canada | ||
+ | \\ \\ \\ | ||
+ | **Example #2:** Create multiple new columns within the same action. | ||
+ | \\ | ||
+ | **Action parameters: | ||
+ | > New column #1: MyDate = today() | ||
+ | > New column #2: MyYear = year([MyDate]) // | ||
+ | |||
+ | |||
+ | |||
+ | \\ | ||
+ | ====Community examples==== | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
\\ | \\ | ||
Line 60: | Line 84: | ||
*Click the drop-down arrow in a column heading and select " | *Click the drop-down arrow in a column heading and select " | ||
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: | + | * [[transformations: |
* [[transformations: | * [[transformations: | ||
* [[transformations: | * [[transformations: | ||
* [[transformations: | * [[transformations: | ||
transformations/addcolumn.txt · Last modified: 2024/02/05 14:20 by craigt