Write, Bureaucrats, Administrators
4,332
edits
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
<div align="right"><small>''« as of 2016-08- | <div align="right"><small>''« as of 2016-08-26, editions Mobile 3.9.7, Desktop 1.0.3 »''</small></div> | ||
----- | ----- | ||
The values in Calculation fields are calculated from the expressions specified by you. | The values in Calculation fields are calculated from the expressions specified by you in Memento Script, defined herein. | ||
The following types of expressions are supported: | The following types of expressions are supported: | ||
; Numeric : Expression involving numbers. | |||
; String : Strings can also be added together, compared, etc... | |||
; Boolean : Expressions that evaluate to true (1.0) and false (0.0). | |||
Numeric and string types can not be mixed in a left / right operand pair. | |||
== Variables == | == Variables == | ||
Line 47: | Line 49: | ||
* ''String result'' is used for expressions that contain string manipulations or functions that return a string. | * ''String result'' is used for expressions that contain string manipulations or functions that return a string. | ||
== Link to | == Link to Entry == | ||
Use the following syntax to get access to the values of entry fields like Link to | Use the following syntax to get access to the values of entry fields like Link to Entry: | ||
<source lang="java"> | <source lang="java"> | ||
#{ | #{field name.child field name} | ||
</source> | </source> | ||
where '' | where ''field name'' – name of field like Link to the entry, ''child field name'' – name of one field of a related entry. | ||
If a field like Link to the entry contains several links, then use index (starts from zero) to get access to them: | If a field like Link to the entry contains several links, then use index (starts from zero) to get access to them: | ||
<source lang="java"> | <source lang="java"> | ||
#{ | #{field name@0.child field name}, #{field name@1.child field name}, … | ||
</source> | </source> | ||
You can specify one of the supported aggregation functions instead of the index: | You can specify one of the supported aggregation functions instead of the index: | ||
<source lang="java"> | <source lang="java"> | ||
#{ | #{field name@sum.child field name} | ||
</source> | </source> | ||
Use the following syntax to get the number of entries in field | This expression returns the sum of values of field child field name for all entries included into field name. In addition, the following functions are supported: avg, min, max. | ||
Use the following syntax to get the number of entries in field field name: | |||
<source lang="java"> | <source lang="java"> | ||
#{ | #{field name@size} | ||
</source> | </source> | ||
Line 80: | Line 83: | ||
==== Example: Percentage ==== | ==== Example: Percentage ==== | ||
Entries contain fields: Count, Total | Entries contain fields: Count, Total | ||
We add a Calculation field Percentage by using the following expression: | We add a Calculation field Percentage by using the following expression: | ||
<source lang="java"> | <source lang="java"> |