What is the Syntax for Referencing Variables

You can reference variables in analyses, dashboards, KPIs, and agents. How you reference a variable depends on the task that you are performing.

For tasks where you are presented with fields in a dialog, you must specify only the type and name of the variable (not the full syntax), for example, referencing a variable in a filter definition.

For other tasks, such as referencing a variable in a title view, you specify the variable syntax. The syntax you use depends on the type of variable as described in the following table.

Note: In the syntax, if the "at" sign (@) is not followed by a brace ({), then it is treated as an "at" sign.

Syntax for Referencing Variables Table

Type of Variable Syntax Example

Presentation

@{variables.variablename}[format]{defaultvalue}

or

@{scope.variables['variablename']}

where:
  • variablename is the name of the presentation or request variable, for example, MyFavoriteRegion

  • (optional) format is a format mask dependent on the data type of the variable, for example #,##0, MM/DD/YY hh:mm:ss. (Note that the format is not applied to the default value.)

  • (optional) defaultvalue is a constant or variable reference indicating a value to be used if the variable referenced by
  • variablename is not populated
  • scope identifies the qualifiers for the variable. You must specify the scope when a variable is used at multiple levels (analyses, dashboard pages, and dashboards) and you want to access a specific value. (If you do not specify the scope, then the order of precedence is analyses, dashboard pages, and dashboards.)

@{variables.MyFavoriteRegion}{EASTERN REGION}

or

@{dashboard.variables['MyFavoriteRegion']}

You also can reference variables in expressions. The guidelines for referenceing vairables in expressions are described in the following table.

Guidelines for Referencing Variables in Expressions

Type of Variable Guidelines Example

Presentation

  • Use this syntax:

    @{variablename}{defaultvalue}

    where variablename is the name of the presentation variable and defaultvalue (optional) is a constant or variable reference indicating a value to be used if the variable referenced by variablename is not populated.

  • To type-cast (that is, convert) the variable to a string, enclose the entire syntax in single quotes, for example:

    '@{user.displayName}'

Note: If the @ sign is not followed by a {, then it is treated as an @ sign.
"Market"."Region"=@{MyFavoriteRegion}{EASTERN REGION}

For the specific areas where you can reference variables, see "Where Can I Reference Variables?".