Scriban variables and templates make documents dynamic: one template spawns a family of reports, and values are substituted into block configurations and queries.
The Scriban engine
Templating is built on the Scriban engine: expressions like {{ variable }} are substituted into titles, block content and query texts. The engine keeps parsed templates around, so it doesn’t re-parse them for every report.
Variables in paths
A document path can contain variables: the template regions/{{ region }}/sales.json produces a separate report for each region — without duplicating JSON.
Variables in content
- variable definitions are set in the document’s JSON, in the
variablesfield; - values are substituted into block configurations and SQL query texts;
- the document title can be a template too — the report’s name changes together with the data;
- an empty variable name is caught by the validator (
EMPTY_VARIABLE_NAME).
Selectors
settings.rangeSelector— the date range selector in the report’s breadcrumbs;settings.timeframeSelector— the timeframe (granularity) selector;- the selected values are available to queries — the report recalculates for the chosen period;
- filters and what-if fields are declared in the report settings and feed values into queries the same way — details in the Reports & Documents section.
Template security
TemplateSecurityService limits template execution: arbitrary code cannot run through Scriban — only whitelisted objects and functions are available.