Skip to main content

Mustache syntax reference

The Mustache tags in this reference can be used to create dynamic content in your visualizations and dashboards.

tip

Check out the Cheatsheet for a high-level summary of all Omni's currently-supported tags.

Syntax

In Mustache, a tag is indicated by double mustaches, for example {{results}}. A tag is made up of one or more keys, which are used to find the requested data. In the previous example, results is the key in {{results}}.

Locating keys

Several Omni tags require specific keys, such as a view_name or a field_name. Refer to the following sections for help finding this information in Omni.

view_name & field_name

The view_name and field_name keys are used in Query field and Query result tags.

To locate the name of a view or field in a query:

  1. Enter draft mode in a workbook.
  2. In the tab of the query, open the Results panel.
  3. In the Fields section, locate a field and click the (caret icon).

Below the Label field will be the name of the view and the field. In the example image (click to enlarge), this is main__customers.id. main__customers is the view_name, and id is the field_name.

Using the query results panel to locate the names of a view and field

control_id

The control_id key is used in Control tags.

To locate the ID of a dashboard control:

  1. Enter draft mode in a dashboard.
  2. Locate the control at the top of the dashboard and click the (pencil icon) to open the Edit control panel.
  3. Locate the ID field at the bottom of the panel. In the example image, the ID is 8v_G12D7.
Highlighted ID value in the Edit control panel

Query fields

info

Query field tags are only supported in visualizations, meaning they can't be used in Markdown dashboard tiles.

Returns metadata about a specific query field.

Syntax
{{fields.view_name.field_name.element}}

Requires the following keys:

  • fields - Accesses query field data
  • view_name - The name of the view that contains the field
  • field_name - The name of the field
  • element - The data you want to retrieve, such as the display name of the field. Refer to the following sections for information on what is currently supported.

View name

Returns the display name of the view that contains the specified field.

Syntax
{{fields.view_name.field_name.view_label}}
Example
{{fields.customers.id.view_label}}
Example view name

Field name

Returns the dispaly name of the field.

Syntax
{{fields.view_name.field_name.label}}
Example
{{fields.customers.id.label}}
Example field name

Query results

info

Query result tags are only supported in visualizations, meaning they can't be used in Markdown dashboard tiles.

Returns a result value from a query. The syntax varies depending on the data point you want to retrieve, but typically looks like the following:

Syntax
{{result.data_point.view_name.field_name.value_type}}

The following keys must always be provided, regardless of the data point being retrieved:

  • result - Accesses query result data
  • data_point - The type of data point you want to retrieve, such as the value of a field in the first row of query results (_first). Refer to the following sections for information on what's currently supported.
  • view_name - The name of the view that contains the field
  • field_name - The name of the field. Refer to the Locating keys section for help finding this and the view_name.
  • value_type - Determines the level of interactivity and formatting of the returned value:
    • value - Interactive; user can click to copy, drill, etc.
    • value_static - Formatting applied, no interactivity
    • raw - No formatting or interactivity

First row value

Returns the first value in the result set for the specified field.

Syntax
{{result._first.view_name.field_name.value_type}}

This example uses value_static, which returns a formatted value with no interactivity:

Example
{{result._first.customers.first_name.value_static}}
Example first row value

Last row value

Returns the last value in the result set for the specified field.

Syntax
{{result._last.view_name.field_name.value_type}}

This example uses value, which allows dashboard users to click and interact with the value. Note the dropdown menu over the value in the example image.

Example
{{result._last.customers.first_name.value}}
Example last row value

Specific row value

Returns a field value from the specified row (row_number) in the result set.

In Omni, row numbering begins at 0. When you define the variable, subtract one from the number of the actual row you want to reference.

Syntax
{{result.row_number.view_name.field_name.value_type}}

For example, to return a value from row 11, use 10 as the row_number:

Example
{{result.10.customers.first_name.raw}}
Example specific row value

Column total

Returns the total of a specified column in the result set. Requires Column totals to be enabled in the query's Results options panel.

Syntax
{{result._total.first.view_name.field_name.value_type}}
Example
{{result._total.first.customers.total_price_sum.value}}
Example filter label

Row total

Returns the total of a specified row (row_number) in a pivoted result set. Requires a query with at least one pivot and for Row totals to be enabled in the query's Results options panel.

In Omni, row numbering begins at 0. When you define the variable, subtract one from the number of the actual row you want to reference.

Syntax
{{result.row_number.row_total.view_name.field_name.value_type}}

For example, to return values from row 6, use 5 as the row_number:

Example
{{result.5.row_total.order_items.sale_price_sum.value}}

Grand total

Returns the grand total of a specified column in a pivoted result set. Requires a query with at least one pivot and for Column totals to be enabled in the query's Results options panel.

Syntax
{{result.totals._first.row_total.view_name.field_name.value_type}}
Example
{{result.totals._first.row_total.customers.total_price_sum.value}}

Query & user attribute inspection

info

Query & user attribute inspection is only supported in Markdown visualizations.

Returns the elements of a query and user attribute metadata in JSON format.

Syntax
{{inspect}}

Filters

Returns metadata about dashboard filters.

Syntax
{{filters.view_name.field_name.element}}

Requires the following keys:

  • filters - Accesses filter data
  • view_name - The name of the view that contains the field used in the filter
  • field_name - The name of the field used in the filter. Refer to the Locating keys section for help finding this and the view_name.
  • element - The data you want to retrieve, such as label. Refer to the following section for information on what's currently supported.

Label

Returns the label of the filter. In a dashboard, open the Edit panel for the filter and locate the Label field.

Syntax
{{filters.view_name.field_name.label}}
Example
{{filters.customers.country.label}}
Example filter label

Summary

Returns the default value (summary) of the filter. In a dashboard, open the Edit panel for the filter and locate the Default value field.

Syntax
{{filters.view_name.field_name.summary}}
Example
{{filters.customers.country.summary}}
Example filter summary

Value

Returns the current value of the filter.

Syntax
{{filters.view_name.field_name.value}}
Example
{{filters.customers.country.value}}

Controls

Returns metadata about dashboard controls.

Syntax
{{controls.control_id.element}}

Requires the following keys:

  • controls - Accesses control data
  • control_id - The ID of the control, located in the Edit control panel. Refer to the Locating keys section if you need help finding this panel.
  • element - The data you want to retrieve, such as label. Refer to the following section for information on what's currently supported.

Label

Returns the label of the control. In a dashboard, open the Edit panel for the control and locate the Label field.

Syntax
{{controls.id.label}}
Example
{{controls.8v_G12D7.label}}
Example control label

Summary

Returns the default value (summary) of the control. In a dashboard, open the Edit panel for the control and locate the Default value field.

Syntax
{{controls.id.summary}}
Example
{{controls.8v_G12D7.summary}}
Example control summary (default value)

Value

Returns the full database name (view_name.field_name) of the field currently selected in the control.

Syntax
{{controls.id.value}}
Example
{{controls.8v_G12D7.value}}
Example control value

JSON

Returns the URL-encoded JSON of the control.

Syntax
{{controls.id.json}}
Example
{{controls.8v_G12D7.json}}
Example output
%7B%22id%22%3A%228v_G12D7%22%2C%22kind%22%3A%22FIELD%22%2C%22type%22%3A%22FIELD_SELECTION%22%2C%22field%22%3A%22customers.birthday%5Bdate%5D%22%2C%22label%22%3A%22Control%20(Switcher)%22%2C%22options%22%3A%5B%7B%22label%22%3A%22Birthday%20Date%22%2C%22value%22%3A%22maincustomers.birthday%5Bdate%5D%22%2C%22isDimension%22%3Atrue%7D%2C%7B%22label%22%3A%22Created%20Date%20Date%22%2C%22value%22%3A%22main__customers.created_date%5Bdate%5D%22%2C%22isDimension%22%3Atrue%7D%5D%7D

User attribute metadata

Returns information about the user attributes associated with the user currently viewing the dashboard.

{{metadata.userAttributes.attribute_reference.element}}

Requires the following keys:

  • metadata - Accesses Omni metadata
  • userAttributes - Accesses Omni user attribute data
  • attribute_reference - The reference of the attribute you want to retrieve data for, for example omni_user_email. The following sections demonstrate some of the Omni system attributes you can use in tags. Refer to the Reference column in Settings > User attributes to locate an attribute's reference.
  • element - The data you want to retrieve. Can be either of the following:
    • label - The display name of the attribute, for example Omni user email
    • values - The attribute value set for the user

User email

Returns the email address (omni_user_email value) of the user currently viewing the dashboard.

Syntax
{{metadata.userAttributes.omni_user_email.values}}

User name

Returns the user name (omni_user_name value) of the user currently viewing the dashboard.

Syntax
{{metadata.userAttributes.omni_user_name.values}}

User ID

Returns the user ID (omni_user_id value) of the user currently viewing the dashboard.

Syntax
{{metadata.userAttributes.omni_user_id.values}}

Is org admin?

Returns true if the user currently viewing the dashboard is an Organization Admin (omni_is_org_admin value). Otherwise, returns false.

Syntax
{{metadata.userAttributes.omni_is_org_admin.values}}

Custom user attribute

Returns the value of a custom user attribute of the user currently viewing the dashboard, where custom_attribute_reference is the reference of the custom attribute.

Syntax
{{metadata.userAttributes.custom_attribute_reference.values}}
Example
{{metadata.userAttributes.blob_entity.values}}

User groups

Returns a list of user groups (omni_user_groups value) that the user currently viewing the dashboard is a member of.

If the user is a member of more than one group, the output will be a comma-delimited list like Group 1, Group 1.

Syntax
{{metadata.userAttributes.omni_user_groups.values}}

Cheatsheet

Omni key locations
How to find key values used in various Omni tags. Refer to the Locating keys section for detailed information.
view_nameRequired for Query field tags and Query result tags. In the Results options panel of a workbook query tab, open the options menu for a field. The text below the Label field contains the view_name. Refer to the Locating keys section for more information.
field_nameRequired for Query field tags and Query result tags. In the Results options panel of a workbook query tab, open the options menu for a field. The text below the Label field contains the field_name. Refer to the Locating keys section for more information.
control_idRequired for Control tags. In a draft dashboard, click the (pencil icon) on a control and locate the ID field in the panel. Refer to the Locating keys section for more information.
attribute_referenceRequired for User attribute tags. Located in the Reference column of Settings > User attributes.
Query fields
Returns metadata about a specific query field. Supported in Markdown visualizations.
View name{{fields.view_name.field_name.view_label}}
Field name{{fields.view_name.field_name.label}}
Query results
Returns a result value from query results. Returned values can be interactive or static. Supported in Markdown visualizations.
Query result value types
Specifies the formatting and interactivity of the returned value.
Interactive valueSpecified with value, ex: {{result._first.view_name.field_name.value}}
Formatted valueSpecified with value_static, ex: {{result._first.view_name.field_name.value_static}}
Raw valueSpecified with raw, ex: {{result._first.view_name.field_name.raw}}
Query result data points
Data points that can be retrieved from results of a query.
First row value{{result._first.view_name.field_name.value_type}}
Last row value{{result._last.view_name.field_name.value_type}}
Specific row value{{result.row_number.view_name.field_name.value_type}}
Column total{{result._total.first.view_name.field_name.value_type}}
Row total (pivot){{result.row_number.row_total.view_name.field_name.value_type}}
Grand total{{result.totals._first.row_total.view_name.field_name.value_type}}
Query & user attribute inspection
Returns the elements of a query and user attribute metadata in JSON format. Supported in Markdown visualizations.
Inspect{{inspect}}
Filters
Returns metadata about dashboard filters. Supported in dashboard Markdown tiles.
Label{{filters.view_name.field_name.label}}
Summary{{filters.view_name.field_name.summary}}
Value{{filters.view_name.field_name.value}}
Controls
Returns metadata about dashboard controls. Supported in dashboard Markdown tiles.
Label{{controls.control_id.label}}
Summary{{controls.control_id.summary}}
Value{{controls.control_id.value}}
JSON{{controls.control_id.json}}
User attributes
Returns information about the user attributes associated with the user currently viewing the dashboard. Supported in dashboard Markdown tiles.
Elements
Specifies the value returned from the user attribute.
Label / display nameSpecified with label, ex: {{metadata.userAttributes.attribute_reference.label}}
Value(s)Specified with values, ex: {{metadata.userAttributes.attribute_reference.values}}
Attributes
Returns the display name or value of the specified user attribute.
User email{{metadata.userAttributes.omni_user_email.element}}
User name{{metadata.userAttributes.omni_user_name.element}}
User ID{{metadata.userAttributes.omni_user_id.element}}
Is org admin?{{metadata.userAttributes.omni_is_org_admin.element}}
Custom user attribute{{metadata.userAttributes.custom_attribute_reference.element}}
User groups{{metadata.userAttributes.omni_user_groups.element}}