Creating a calculation formula
We will generate a simple example of a calculation using two Number fields.
- Add 2 different number fields and name them First Number and Second Number.
- Add a third Number field which will handle the result of the calculation. Name it Total. Ensure that this field is positioned after the first two Number fields.
- Access the field settings of the Total field.
- Access the field settings of the Total field. Click the button Insert Merge Tag and select your first field in the calculation.
- Add a mathematical operator. In this case, simple addition (+).
- Insert the Second Number field to complete the calculation.
- Your calculation is all set. Be sure you Save your form.
Symbol | Use | Result | Explanation | Version |
+ | 2+3 | 5 | Addition Operator | |
– | 3-2 | 1 | Subtraction Operator | |
/ | 4/2 | 2 | Division operator | |
* | 4*2 | 8 | Multiplication Operator | |
pi | pi | 3.14 | Math constant pi | |
e | e | 2.71 | Math constant e | |
mod | mod(3,2) | 1 | Modulus Operator | |
floor | floor(5.95) | 5 | Returns the largest integer less than or equal to a given number. | |
round | round(5.5) | 6 | Returns the value of a number rounded to the nearest integer. | |
min | min(4,3,5,36) | 3 | Returns the number with the lowest value. | |
max | max(4,3,5,36) | 36 | Returns the number with the highest value. | |
avg | avg(10,20,60) | 30 | Its value can be obtained by calculating the sum of all the values in a set and dividing the sum by the number of values. | |
abs | abs(-3) | 3 | Returns the absolute value of a number | |
random | random(100,999) | e.g: 342 | Returns a random number | |
sqrt | sqrt(16) | 4 | Returns the square root of a number | |
sin | sin(0) | 0 | Returns the sine of a number. | |
cos | cos(o) | 1 | Returns the cosine of the specified angle, which must be specified in | |
if | if(1>3,1,2) | 2 | It allows you to make logical comparisons between a value and what you expect. | pro |
switch | number =21 switch(number,10,2,20,30,4) | 4 | The function evaluates one value (called the expression) against a list of values, and returns the result corresponding to the first matching value. | pro |
pow | pow(2,3) | 8 | Power function with two operator | pro |
days | days(2022-12-20,2021-11-06) | 409 | Days Between Two Dates | pro |
months | months(2022-12-20,2021-11-06) | 13 | Months Between Two Dates | pro |
years | days(2022-12-20,2021-11-06) | 1 | Years Between Two Dates | pro |