Skip to content

#calc & #var

Perform calculations within templates by using the following data helpers:

  • #calc
  • #var

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

The data helper supports addition, subtraction, division, multiplication and ukvatrate.

ValuesData MarkerOutput
57.50{{#calc 5 + 7.50}}12.50
search.fee = 100.00land.registration.fee = 7.00{{#calc search.fee + land.registration.fee}}107.00
ValuesData MarkerOutput
124{{#calc 12 - 4}}8.00
property.price = 350,000deposit.amount = 30,000{{#calc property.price - deposit.amount}}320,000.00
ValuesData MarkerOutput
63{{#calc 6 / 3}}2
deposit.amount = 20,000{{#calc deposit.amount / 2}}10,000
ValuesData MarkerOutput
99{{#calc 9 * 9}}81
fees.our.legal.fee = 100{{#calc fees.our.legal.fee * 2}}200

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

Data MarkerOutput
{{#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

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

Data MarkerOutput
{{#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

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 #abs Data Helper can be used to covert a negative value to a positive.

ValuesData MarkerOutput
$legalfee = -5{{#abs $legalfee}}5

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

Data MarkerOutput
{{#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