Skip to main content
Skip table of contents

Scoped variables

The Portal allows you to define variables that are visible to several components within the Portal. For example, it may be useful to store the current year in a Scoped Variable. These scoped variables are linked to a specific folder or dashboard and are only visible to that object and all its descendants.

Scoped variable settings

Scoped variables are defined as static or dynamic in the Expression Settings of the variable's properties.

  • A static scoped variable can take an explicitly defined value (for example, the integer 20). Explicitly defined values are specified by the Value property.
  • A dynamic scoped variable can take a value determined by a formula acting on the current session data (say, today's date, or the current user's first name). Formula-defined values are determined by the Select Statement attribute, which contains a SQL query.

Setting

Description

Expression Type

Determines whether the value of the scoped variable is a dynamic (based on a query) or a static value.

Static value

This setting appears when the Static expression type is selected.
The static value is returned when this scoped variable is referenced. This value can contain a reference to another scoped variable, also known as a nested scoped variable. It may also contain @@PROMPT() references, thereby incorporating user selection from Dashboard Filters.

Source Connection

This setting appears when the Dynamic expression type is selected. It defines the SQL connection that will be used to perform the dynamic query.

Select Statement

This setting appears when the Dynamic expression type is selected.
This is the SQL query select statement that will be executed to return the results for this scoped variable from the specified database connection.
If the Select Statement in a dynamic Scoped Variable returns more than one value, the value of the Scoped Variable is set to a string containing a comma-delimited list of these values.

Nested scoped variables

Scoped Variables can be nested within each other. To nest a scoped variable, place an @@VARIABLE reference in the Select Statement or Static value properties of the scoped variable.

When nesting scoped variables, make sure you do not nest a scoped variable that is already nested in another variable that uses this scoped variable, because this will cause an infinite loop.
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.