---
title: "Variables & Templates"
id: "1757"
type: "page"
slug: "variables"
published_at: "2026-09-20T21:16:34+00:00"
modified_at: "2026-09-21T01:36:28+00:00"
url: "https://xedant.com/agents/analytics/docs/variables"
markdown_url: "https://xedant.com/agents/analytics/docs/variables.md"
excerpt: "Scriban variables and templates make documents dynamic: one template spawns a family of reports, and…"
---

# Variables & Templates

[https://xedant.com/agents/analytics/docs/variables.md](https://xedant.com/agents/analytics/docs/variables.md)

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 `variables` field;
- 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](/agents/analytics/docs/reports) section.

## Template security

`TemplateSecurityService` limits template execution: arbitrary code cannot run through Scriban — only whitelisted objects and functions are available.

[← Back to the documentation index](/agents/analytics/docs)
