A report template turns the results of a data graph into a finished document, drawing on named values, the choices a report is run with, and a set of helpers that format those values for the page. Those three things are what a template body can reference. To design a template alongside its data, see Report templates.
Slots
A slot is a named value that a data graph produces, dropped into the document wherever it belongs. When a report renders, each slot is filled with the value its data graph worked out.
Every template is bound to one data graph. The data graph gathers and shapes the report's data — totals, lists, and single values — and hands back each result under a name. Every one of those named results is a slot the template body can pull in by that name. In the body, a slot appears as its name wrapped in double braces:
{{ average_response_time }}
Because slots come from the data graph, they change with it. A data graph that produces an average response time, a list of open entries, and a site name gives the template three slots to place. Point a template at a different data graph and its slots change to whatever that graph produces.
A template can also show the report's own reference number. That number exists once the report is generated, so a preview — which saves nothing — shows a stand-in in its place.
Parameters
Parameters are the choices a report is run with. They tell the data graph what to gather — which part of your organisation to cover, and over what stretch of time — and the template body can show them too.
A data graph decides its own parameters, so the exact set depends on how the graph was built. A common set is the part of your tree to cover, a timezone, and a window of time — often given as a start and an end, or as a month and a year. The parameters a person fills in become the report's inputs: the preview inputs you set while building the template, and the fields someone completes when they generate the report on demand or on a schedule.
The body can reference a parameter by name, so a report can state the month it covers or the timezone its times are shown in. A report takes its period from these parameters, not from the clock, so a report run for an earlier month still shows that month.
The timezone parameter does more than fill a heading. The date and time helpers localise their values to it, so a report shows its times in the timezone it was run for. A report without a timezone shows its times in UTC.
Formatting helpers
Helpers shape a raw value for the page. A date arrives as a machine timestamp, a stored choice arrives as high_priority, a column of numbers arrives as a list. A helper turns each into something a reader can take in — a formatted date, readable words, a total. The template body applies them, and when the assistant writes the body it reaches for them for you. In the body, a helper follows the value it works on, after a vertical bar:
{{ generated_at | format_datetime }}
Dates and times
Text
Numbers and lists
Images and links
Time helpers
A few helpers stand in for a moment in time, so a document can stamp when it was made.