Template Variables
Template Variable Assignments
Sometimes you want to calculate some value based on data input and reuse it across the document. You can do that using assignments within smart fields then you can use assign value within Smart Fields or Smart Sections Multiple Times
Cost of labor: {labor} USD
Cost of parts: {parts} USD
Total Cost: {$ total = labor+parts } USD
Total Cost + Tax: {$ total * 1.22 } USD (Including 22% Tax)
{#$ total > 1000 }
Warning! Your total net cost exceeds 1000 USD
{/}
Hidden Variables
You can combine variables with a hide formatter. To create hidden calculated fields that you can use across your template. (E.g. You can define them at the top of the page based on values passed for document generation and use it in your template.
Cost of labor: {labor} USD
Cost of parts: {parts} USD
{$ total = (labor+parts) * 1.22 | hide}
Total Cost + Tax: {$ total} USD (Including 22% Tax)
Payment of {$ total} USD is due by 10-10-2026
Conditional Variables
You can combine variables with Smart Fields to use conditions to define multiple reusable values based on passed data.
Field value: {sampleField} (Assuming it could be value 'opt1' or 'opt2')
{$ variableName = sampleField == 'opt1' ? 'Text if option 1' : 'Text if not'}
{$ anotherVariableName = sampleField == 'opt1' ? 'Different text if option 1' : 'Different text if not'}
Last updated