User Tools

Site Tools


syntax:start

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
syntax:start [2017/12/23 09:55] dmitrysyntax:start [2025/06/24 00:18] (current) dmitry
Line 1: Line 1:
 ====== Expressions ====== ====== Expressions ======
  
-In EasyMorph you can use expressions to [[transformations:addcolumn|calculate new columns]] or build complex conditions for [[transformations:filter|filtering table rows]]. An expression is calculated for every row of a table and can include:+In EasyMorphyou can use expressions to [[transformations:addcolumn|calculate new columns]] or build complex conditions for [[transformations:filter|filtering table rows]]. An expression is calculated for every row of a table and can include:
  
   * Numbers and text strings (see [[syntax:types|Type system]])   * Numbers and text strings (see [[syntax:types|Type system]])
Line 9: Line 9:
  
 === Field names === === Field names ===
-You can refer to values in columns of the table where the expression is calculated by putting column names in square brackets, e.g. [Amount]. Field names can include spaces, digits and non-alphabetical characters in any order.+You can refer to values in columns of the table where the expression is calculated by putting column names in square brackets, e.g. [Amount]. Field names can include spaces, digitsand non-alphabetical characters in any order.
  
 When expression is calculated for a row, field names are replaced with values in these fields stored in the row. It's not possible to refer to values from another row or another table. When expression is calculated for a row, field names are replaced with values in these fields stored in the row. It's not possible to refer to values from another row or another table.
  
-Field names are case sensitive -- i.e. [Total], [TOTAL] and [total] are 3 different field names.+Field names are case sensitive -- i.e. [Total], [TOTAL]and [total] are 3 different field names.
  
 === Parameters === === Parameters ===
 An expression can refer to [[parameters:|project parameters]] that are evaluated to text or number constants prior to calculating the expression. Parameter names in expressions are wrapped in curly brackets and are case-sensitive. E.g. {File name}, {Ratio}. An expression can refer to [[parameters:|project parameters]] that are evaluated to text or number constants prior to calculating the expression. Parameter names in expressions are wrapped in curly brackets and are case-sensitive. E.g. {File name}, {Ratio}.
 +
 +
 +=== Comments ===
 +Expressions can be annotated (commented). Any text between a double-slash (%%//%%) and the end of line is considered a comment and is ignored during expression evaluation. A comment can't span several lines. Example:
 +
 +<code>
 +//Converted amount.
 +[Amount] * {FX Rate}  // Using a parameter for the exchange rate.
 +</code>
  
 === Example 1 === === Example 1 ===
  
-Let's assume we want to calculate new field 'Net Amount' using the following expression:+Let's assume we want to calculate new field 'Net Amount' using the following expression:
  
   [Price] * [Quantity] * ( 100 - [Discount %] ) / 100   [Price] * [Quantity] * ( 100 - [Discount %] ) / 100
Line 33: Line 42:
 === Example 2 === === Example 2 ===
  
-Let's assume we want to calculate new field 'Total Tax' using the following expression:+Let's assume we want to calculate new field 'Total Tax' using the following expression:
  
   [Amount] * if( [Province]='QC', 13.5, 12.5) / 100 * {Multiplier}   [Amount] * if( [Province]='QC', 13.5, 12.5) / 100 * {Multiplier}
Line 46: Line 55:
  
  
-=== A few transformations that use expressions ===+=== A few actions that use expressions ===
   * [[transformations:addcolumn|Calculate new columns]]   * [[transformations:addcolumn|Calculate new columns]]
-  * [[transformations:replacecolumn|Calculate and replace columns]]+  * [[transformations:replacecolumns|Calculate and replace columns]]
   * [[transformations:rule|Rule]]   * [[transformations:rule|Rule]]
   * [[transformations:filter|Filter by condition]]   * [[transformations:filter|Filter by condition]]
   * [[transformations:trimbycondition|Trim by condition]]   * [[transformations:trimbycondition|Trim by condition]]
   * [[transformations:halt|Halt on condition]]   * [[transformations:halt|Halt on condition]]
 +
 +=== Generating expressions from description ===
 +Starting from v5.9.6, it's possible to generate an expression from a description in plain English. To learn more, read [[syntax:generate|How to describe expressions]].
syntax/start.1514040950.txt.gz · Last modified: 2017/12/23 09:55 by dmitry

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki