Worked templating example
This page walks through a single template that uses most of the language at once — data markers, a condition, a calculation, a loop, a question, and a formatted date. Read it top to bottom to see how the pieces fit together.
The template
Section titled “The template”{{#var $price = property.price}}{{#var $deposit = property.price / 10}}Dear {{stakeholder.client.1.forename}},
Re: {{matter.name}} ({{matter.reference}})
Thank you for your instructions.{{#if property.price}} The agreed price is {{$price}}, so a 10% deposit of {{$deposit}} will be payable on exchange.{{#endif}}
Work carried out so far:{{#foreach matter.timerecords numerical-sort-by amount desc}}- {{type}} by {{feeearner}}: {{amount}}{{#endforeach}}{{#question $includeSurvey "Offer a survey?"}}{{#if $includeSurvey}}We can also arrange a full structural survey — just let us know.{{#endif}}This letter was prepared on {{#datetime $now 'd mmmm yyyy'}}.
Kind regards,{{currentuser.fullname}}What each part does
Section titled “What each part does”| Part | Feature | Guide |
|---|---|---|
{{stakeholder.client.1.forename}} | Data marker | Data markers |
{{#var $deposit = property.price / 10}} | Calculation stored in a variable | Maths |
{{#if property.price}} … {{#endif}} | Condition | Conditionals |
{{#foreach matter.timerecords …}} | Loop with sorting | Loops |
{{#question $includeSurvey …}} | Yes/no question | Composition |
{{#datetime $now 'd mmmm yyyy'}} | Formatted date | Formatting |
Example output
Section titled “Example output”Assuming the client is John, the price is 250000, two time records exist, and the survey question is answered yes:
Dear John,
Re: Sale of 1 High Street, Smith (MAT-000123)
Thank you for your instructions. The agreed price is 250,000.00, so a 10% deposit of 25,000.00 will be payable on exchange.
Work carried out so far:- Attendance by A. Solicitor: 350.00- Letter by T. Trainee: 60.00
We can also arrange a full structural survey — just let us know.
This letter was prepared on 2 January 2025.
Kind regards,Jane Fee-Earner