Skip to main content

Helpers

Helpers are functions that let you perform basic text transformations within your template.

{{contains}}

Checks if a given value exists within an array.

<!-- array: ['a', 'b', 'c'] -->

{{#if (contains array "a")}}
Success!
{{else}}
Not Found!
{{/if}}

<!-- result: 'Success!' -->

{{date}}

Formats the timestamp in a given field using a date format. Uses helper-date.

The field value must be a Unix timestamp or any of the formats supported by date.js.

<!-- Time: 1598791377556 -->

{{date Time "YYYY-MM-DD"}}

<!-- result: '2020-08-30' -->

{{eq}}

Compares two strings for equality.

<!-- app: foo -->

{{#if (eq app "auth")}}
This is the auth app.
{{else}}
This is not an auth app.
{{/if}}

<!-- result: 'Success!' -->

{{join}}

Join all elements of array into a string using a given separator.

<!-- array: ['a', 'b', 'c'] -->

{{join array "-"}}

<!-- result: 'a-b-c' -->

{{json}}

Version

Supported since Dynamic Text panel 2.2.0.

Present object (JSON) or array as a formatted string. Markdown supports syntax highlight.

<!-- object or array -->

```json
{{json obj}}
```

<!-- result: as string -->
Visualize formatted JSON object.
Visualize formatted JSON object.

Transformation

JSON helper expects an object or array to display it as a formatted string. If the data source returns a string it should be transformed to a JSON object using Transformation Convert field type.

Transform JSON string to object.
Transform JSON string to object.

{{split}}

Version

Supported since Dynamic Text panel 2.2.0.

Split a string into an array using a given separator.

<!-- string: 'a,b,c,d' -->

{{split str ","}}

<!-- result: ['a','b','c'] -->
Examples of splitting string into array.
Examples of splitting string into array.

{{toFixed}}

Formats the given number using fixed-point notation.

<!-- Value: 1.1234 -->

{{toFixed Value 2}}

<!-- result: '1.12' -->