User Tools

Site Tools


transformations:rule

Differences

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

Link to this comparison view

Next revisionBoth sides next revision
transformations:rule [2015/01/29 23:16] – created dmitrytransformations:rule [2015/04/10 14:47] elenap
Line 1: Line 1:
 ===== Rule ===== ===== Rule =====
  
-This transformation calculates new or replaces column by using nested IF...THEN...ELSE conditions. While the same result can be achieved using an expression with nested [[syntax:functions:if]] functions the use of Rule transformation is recommended for clarity and readability.+This transformation calculates new or replaces column by using nested IF...THEN...ELSE conditions. While the same result can be achieved using an expression with nested [[syntax:functions:if]] functionsthe use of Rule transformation is recommended for clarity and readability.
  
 Rule transformation is somewhat similar to //switch// or //case// statements in popular programming languages. Rule transformation is somewhat similar to //switch// or //case// statements in popular programming languages.
 +
 +EXAMPLE
 +
 +**Source table:** Average income and deductions
 +
 +^  Country  ^  Gross income    Disposable income  ^  Compulsory deductions  ^
 +| United States  |  56067  |  45582  |  18.7%  |
 +| Australia  |  51050  |  42617  |  16.52%  |
 +| Switzerland  |  53716  |  48414  |  9.87%  |
 +| Canada  |  45896  |  37469  |  18.36%  |
 +
 +**Objective:** Add a column describing the average spending potential in each country as low or high, based on the disposable income. 
 +The spending potential is high if the disposable income is $40,000 or more.
 +
 +**Transformation parameters:**
 +  * Create new column: Spending
 +  * Calculated as: if ([Disposable income] > 40000), then HIGH.
 +  * If none of the condition above is met: Default to LOW
 +
 +**Output table:**
 +
 +^  Country  ^  Gross income    Disposable income  ^  Compulsory deductions  ^  Spending  ^
 +| United States  |  56067  |  45582  |  18.7%  |  HIGH  |
 +| Australia  |  51050  |  42617  |  16.52%  |  HIGH  |
 +| Switzerland  |  53716  |  48414  |  9.87%  |  HIGH  |
 +| Canada  |  45896  |  37469  |  18.36%  |  LOW  |
transformations/rule.txt · Last modified: 2021/07/19 02:30 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki