The data type “Calculation” allows to define mathematical formulas that can include other number attributes of the same field definition as variables. The calculation attribute of a field instance will then present the result, based on the current values of number attributes that are used as variables.
When creating or editing a field definition, add a data attribute of type “Calculation” and enter a mathematical formula. If the current field definition contains other data attribute of type number, you may reference these as variables within your formula by typing the “@” character. You may also add number attributes later on and reference those, too.
The examplary field definition contains three data attributes of type number to store the planned budgets of different departments. To compute the total budget on the fly, we create a calculation that sums up their values.
Mathematical Operators and Constants
You may create complex formulars by using the following operators and constants:
Symbol | Meaning | Example |
---|---|---|
+ | Addition | 1+1=2 |
- | Subtraction | 1-1=0 |
* | Multiplication | 1*1=1 |
/ | Division | 1/1=1 |
^ | Power | 2^2=4 |
# | Modulo | 3#2=1 |
log | Logarithmic function | log10(1000)=3 log2(1000)=9.9 |
ln | Natural logrithm | ln(2)=0,693 |
sqrt | Square root | sqrt(4)=2 |
sin,cos,tan | Trogonemtric functions | sin(pi)=0 |
pi | Pi | 3.141 |
e | Euler | 2,718 |