Skip to content
This is an archived version of the documentation downloaded from LogScale Documentation Archives. Up to date documentation, and documentation for later versions, is available on LogScale Documentation

## Template Expressions

LogScale template expressions are specialized code snippets that allow users to access and manipulate variables within dashboards and other UI elements using either dot notation or bracket notation syntax. Template expressions must be enclosed in double curly braces {{ }} and can be used in various UI components like Dashboard Interactions and custom link columns, enabling dynamic content insertion and variable access.

LogScale template expressions are little pieces of code which define how to access and use a variable that is available e.g., in a given dashboard.

These expressions have a special Template Syntax inspired by popular programming frameworks which also use template expressions.

In LogScale, you can use language expressions in parts of the UI where the template language is adopted, such as in Dashboard Interactions or when adding a new custom link column in fields (see Add and Remove Fields).

In these cases, you write your expressions in dedicated text boxes available in the UI (e.g., Title template, URL template boxes).

An expression is valid when written inside a string of characters started by `{{` and ending with `}}`. Everything in between the pair of opening and closing curly braces will be evaluated as an expression.

For example, writing `{{ startTime }}` will extract the value from the variable named `startTime` and inject it into the string, replacing the template expression — see some examples of how this is done at Template Variable Types.

### Template Syntax

You can use two different accessors to write variables in expressions:

- Dot notation — write `fields` followed by a `.`, followed by the name of the field you want to use. For example:

      {{ fields.dayOfWeek }}

- Bracket notation — write `fields` followed by the name of the field in square brackets. This is a more verbose but flexible accessor that you can use for cases when field names contain special characters, for example a `\` character:

      {{ fields["strange\"fieldName\""] }}

#### Enter search term