Conditions
To conditionally include content in your template, use a condition structure.
Conditions syntax is similar to loops, start with {{>>tag}} and
end with {{<<}}, where "tag" refers to a boolean value in your
data:
{{ PremiumContent }}
{{<< }}
Provide a boolean value in your data to control the condition:
The content between the condition tags will only be included if the condition evaluates to true (the checkbox is checked).
Simple Example
Given this template:
Welcome{{>> IsRegistered }}, {{ Username }}{{<<}}!
The following data will be used to conditionally include the content:
And the output document will be:
Welcome, John!
Alternatively, if the condition evaluates to false (the checkbox is unchecked):
The output document will be:
Welcome!
Advanced Example
This example demonstrates conditions within a table loop. The template shows a sales report where we display additional status information for pending orders:
| Order ID | Status |
|---|---|
| {{>> Orders}}{{ID}} | {{Status}} {{>> IsPending}}(Estimated: {{DeliveryDate}}){{<<}}{{<<}} |
Remember to close both the condition tag and the loop tag with {{<<}} for each.
The data for this template:
The output document will look like this:
| Order ID | Status |
|---|---|
| ORD-01 | Completed |
| ORD-02 | Pending (Estimated: 2024-03-15) |
| ORD-03 | Completed |