Calculations


You can perform calculations within templates by using the following data helpers.

#calc

The #calc data helper performs the defined calculation and outputs the result into the template.

The data helper supports additionsubtractiondivision, multiplication and ukvatrate.

Addition

Values

Data Marker

Output

5

7.50

{{#calc 5 + 7.50}}

12.50

search.fee = 100.00

land.registration.fee = 7.00

{{#calc search.fee + land.registration.fee}}

107.00

Subtraction

Values

Data Marker

Output

12

4

{{#calc 12 - 4}}

8.00

property.price = 350,000

deposit.amount = 30,000

{{#calc property.price - deposit.amount}}

320,000.00

Division

Values

Data Marker

Output

6

3

{{#calc 6 / 3}}

2

deposit.amount = 20,000

{{#calc deposit.amount / 2}}

10,000

Multiplication

Values

Data Marker

Output

9

9

{{#calc 9 * 9}}

81

fees.our.legal.fee = 100

{{#calc fees.our.legal.fee * 2}}

200

UK VAT

settings.ukvatrate can be used to include the current UK VAT rate into calculations

Data Marker

Output

{{#calc fees.our.legal.fee * settings.ukvatrate}}

The legal fees VAT 

{{#calc fees.our.legal.fee + fees.our.legal.fee * settings.ukvatrate}}

The legal fee including it's VAT rate

Australia GST

settings.ausgstrate can be used to include the current Australian GST rate into calculations

Data Marker

Output

{{#calc fees.our.legal.fee * settings.ausgstrate}}

The legal fees GST

{{#calc fees.our.legal.fee + fees.our.legal.fee * settings.ausgstrate}}

The legal fee including it's GST rate

#var

A #var Data Helper can be used to recall previously defined figures within a template.

To use this:

  1. Define the conditions of the #var, for example:
    {{#var $discount = fees.our.legal.fee * 0.2}}
  2. Use the newly created var statement to recall the figure
    {{$discount}}will output fees.our.legal.fee * 0.2
The name of the variable can only be made up of letters and numbers.

#abs

The #abs Data Helper can be used to covert a negative value to a positive.

Values

Data Marker

Output

$legalfee = -5

{{#abs $legalfee}}

5

Greater Than and Less Than Symbols

< / > can be used to define an output depending on the value of a field

Data Marker

Output

{{#if $legalfee > 0}} We owe you {{$legalfee}} {{#else}} You owe us {{$Legalfee}}{{#endif}}

If the legal fee is more than 0, output: We owe you

If the legal fee is less than 0, output: You owe us

<< Previous      Next >>
Powered by HelpDocs (opens in a new tab)