Numerical Calculations

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.

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}}

Numerical Calculation in Loops & Tables

You can also use Numerical Calculation in Loops & Tables.

Example
{{#each line_items}}
Name: {{Name}}
Qty: {{Qty}}
Price: {{Price}}
Total: {{multiply Qty Price}}
{{/each}}

Incrementing @index in Loops & Tables

If you want to display the index of an element while iterating the loop, you can use {{@index}}. It usually starts from 0, so everytime you will have to increment it with 1. You can use add operator with @index.

Example
{{#each line_items}}
Sno: {{add @index 1}}
Name: {{Name}}
Qty: {{Qty}}
Price: {{Price}}
Total: {{multiply Qty Price}}
{{/each}}