Numerical Calculations
Last updated
Last updated
Want to calculate the numerical value for a field based on merge tokens? You can do so by entering your mathematical equation in the format below.
You can also use Numerical Calculation in Loops & Tables.
When iterating through a list, @index
is useful for displaying the position of each element within the loop. By default, @index
starts from 0. However, you can adjust it to start from 1 by using the addition operator.
Syntax for Incrementing @index
To increment @index
so that numbering starts from 1, you can use the add
operator like this: {{add @index 1}}
.
Example
Here's how you can use @index
in a loop to display a sequence number along with other item details in a table format:
Rounding of the numbers can be done using the helpers ceil, floor, and round.
The helper ceil will round off the number to the nearest positive number which is greater than or equal to the give input number.
The helper floor will round off the number to the nearest positive number which is lesser than or equal to the given input number.
Round helper will round of the given number in accordance with the value in it's decimal place. If the value in decimal places is greater than 50, then it will round of to the succeding number.
Example syntax | Input | Output |
---|---|---|
Example syntax | Input | Output |
---|---|---|
Example syntax | Input | Output |
---|---|---|
Operation
Syntax with two variables
Syntax with a variable & constant
Addition
{{add x y}}
{{add x 10}}
Subtraction
{{subtract x y}}
{{subtract x 10}}
Multiply
{{multiply x y}}
{{multiply x 10}}
Divide
{{divide x y}}
{{divide x 10}}
Modulo
{{modulo x y}}
{{modulo x 10}}
Rounding of numbers
{{ceil x}} / {{floor x}} / {{round x}}
{{ceil number}}
198.58
199
{{ceil input}}
187.24
188
{{floor number}}
198.58
198
{{floor input}}
187.24
187
{{round number}}
198.58
199
{{round input}}
-187.74
-188