Skip to main content
This page is the reference for the template tags, filters, and operators in Reporter. For an introduction to templates and placeholders, see What is Reporter.

Building templates


Common blocks

  • Loop
  • Loop with explicit schema
  • Simple condition
  • Temporary scope
  • Value formatting

Conditional blocks

Tags reference


Aggregation tags

sum_by — Sums numeric values from a field across all items in a collection.
Example:
count_by — Counts the number of items in a collection.
Example:
avg_by — Calculates the average of numeric values in a field.
min_by — Finds the minimum numeric value in a field.
max_by — Finds the maximum numeric value in a field.
All aggregation tags use decimal precision to avoid floating-point rounding errors. Missing or non-numeric fields are skipped. Returns 0 if no items match.

Date and time tag

date_time — Outputs the current date and time in the Reporter runtime’s local time zone, formatted according to the provided format string.
Format codes: Examples:

Arithmetic tag

calc — Evaluates mathematical expressions with support for variables from the template context.
Supported operators: Examples:
Variables that cannot be resolved default to 0. Division by zero produces an error.

Grouped selection tag

last_item_by_group — Groups items by a field and selects the most recent item per group, ordered by a date field (descending). Optionally filters items first. Useful for regulatory reports that require the latest record per account grouped by category.
The result is a list of items — the latest one per group — stored in a variable you can iterate over. Each element is the original collection record, so you access its own fields:
group_by accepts a comma-separated list of fields for composite grouping. Maximum collection size: 100,000 items. Results are sorted by the group_by value for deterministic output.

Counter tags

counter — Increments a named counter by 1. Produces no output. Counters are scoped per render.
counter_show — Displays the sum of one or more named counters.
Example:

Filters reference


percent_of

Calculates the percentage of a value relative to a total. Returns a formatted string with 2 decimal places.
Example: if category.amount = "6.00" and total.expenses = "20.00":

strip_zeros

Removes trailing zeros from a numeric value without rounding.
Examples:

decimal

Prints a number with a fixed number of decimal places, from 0 to 18.
Examples:
Only rjust, ljust, or center can follow decimal in the same expression. Reporter refuses a template that uses decimal inside a {% %} tag.

slice

Extracts a substring using start and end indices (0-based).
Examples:

replace

Replaces all occurrences of a search string with a replacement string. Format: "search:replacement".
Examples:

where

Filters an array of objects by field equality. Supports nested fields via dot notation.
Examples:
Use inside loops:

sum (filter)

Sums numeric values from a field across all items in an array. Uses decimal precision.
Examples:

count (filter)

Counts elements in an array where a field matches a value. Supports nested fields.
Examples:

add_day

Adds a dia field to each row of a list. The value is the day of the named date field, as a number in YYYYMMDD form. Use it to group or compare rows by day.

add_signed

Adds a signed field to each row of a list. The value is the named amount, negative when the row’s direction is debit. Use it to sum a net balance.

filter (function)

Returns the rows of a list whose field equals a value.

contains

Checks if one value is partially included in another, ignoring case. Useful when data includes dynamic prefixes or suffixes.
Example:
  • Source: 0#@external/BRL
  • Target: @external/BRL
Returns true because @external/BRL exists within the source value.

Operators and filters summary


Advanced filtering


When generating a report, you can pass filters in the request body to narrow the data. Filters follow a structure of datasource > table > field: Single schema (default):
Multi-schema (explicit schema.table key):
Supported operators: