Skip to main content
All CollectionsUsing the Platform
Using Dynamic Content Within Report Templates: Text Box Component Variables
Using Dynamic Content Within Report Templates: Text Box Component Variables

Learn how to use the report template tags to embed dynamic content in your reports

Michał Wieczorek avatar
Written by Michał Wieczorek
Updated today

Introduction

When designing report templates, it is essential to incorporate dynamic content to ensure that reports are adaptable to various contexts. One effective way to achieve this is through text box component variables. These variables enable reports to include dynamic data based on specific project attributes, making the templates more flexible and useful.

Available Variables

Text components support several predefined variables that can automatically populate reports with relevant project details. Below are some of the most commonly used variables:

1. {{ project_name }}

This variable is dynamically replaced with the project's name when the report is generated.

2. {{ project_location }}

Represents the project's location, which is typically the name of the intersecting administrative boundary at level 2 (e.g., county or district name).

3. {{ project_country }}

Displays the name of the country where the project is located.

4. {{ created_at }}

Denotes the timestamp of when the report was generated, formatted in ISO8601 (e.g., 2024-10-18T11:23:45.594623).

Modifying Variable Output

The {{ variable }} syntax supports modifications using filters, allowing customization of variable output. One common use case is formatting the date to a more readable format.

Example: Formatting the Date

If the raw output of {{ created_at }} is 2024-10-18T11:23:45.594623, you can format it into a more user-friendly format, such as YYYY-MM-DD.

Applying a Filter:

{{ created_at | date: '%Y-%m-%d' }}

This will transform 2024-10-18T11:23:45.594623 into 2024-10-18.

Available filters

String

append, prepend, capitalize, upcase, downcase, strip, lstrip, rstrip, strip_newlines, split, replace, replace_first, replace_last, remove, remove_first, remove_last, truncate, truncatewords, normalize_whitespace, number_of_words, array_to_sentence_string

Date

date, date_to_xmlschema, date_to_rfc822, date_to_string, date_to_long_string

Conclusion

Using text box component variables enhances the flexibility and automation of report templates. By leveraging dynamic content, reports can be tailored to specific projects and locations, reducing manual input and improving efficiency. Additionally, modifying variable output using filters allows for better formatting and readability, ensuring that the final report meets the desired presentation standards.

Did this answer your question?