Skip Headers
Oracle® Business Intelligence Enterprise Edition Help
11g Release 1 (11.1.1)
  Go To Table Of Contents
Contents

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 Table 2-1.


Note:

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


Table 2-1 Syntax for Referencing Variables

Type of Variable Syntax Example

Session

@{biServer.variables['NQ_SESSION.variablename']}

where variablename is the name of the session variable, for example DISPLAYNAME.

For a list of system session variables that you can use, see "About System Session Variables" in Oracle Fusion Middleware Metadata Repository Builder's Guide for Oracle Business Intelligence Enterprise Edition.

@{biServer.variables['NQ_SESSION.USER']}

Repository

@{biServer.variables.variablename}

or

@{biServer.variables['variablename']}

where variablename is the name of the repository variable, for example, prime_begin.

@{biServer.variables.prime_begin}

or

@{biServer.variables['prime_begin']}

Presentation or request

@{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 referencing variables in expressions are described in Table 2-2.

Table 2-2 Guidelines for Referencing Variables in Expressions

Type of Variable Guidelines Example

Session

  • Include the session variable as an argument of the VALUEOF function.

  • Enclose the variable name in double quotes.

  • Precede the session variable by NQ_SESSION and a period.

  • Enclose both the NQ_SESSION portion and the session variable name in parentheses.

"Market"."Region"=VALUEOF(NQ_SESSION."SalesRegion")

Repository

  • Include the repository variable as an argument of the VALUEOF function.

  • Enclose the variable name in double quotes.

  • Refer to a static repository variable by name.

  • Refer to a dynamic repository variable by its fully qualified name.

    If you are using a dynamic repository variable, then the names of the initialization block and the repository variable must be enclosed in double quotes ("), separated by a period, and contained within parentheses. For example, to use the value of a dynamic repository variable named REGION contained in a initialization block named Region Security, use this syntax:

    VALUEOF("Region Security"."REGION")

    For more information, see "About Repository Variables" in Oracle Fusion Middleware Metadata Repository Builder's Guide for Oracle Business Intelligence Enterprise Edition.

CASE WHEN "Hour" >= VALUEOF("prime_begin") AND "Hour" < VALUEOF("prime_end") THEN 'Prime Time' WHEN ... ELSE...END

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?".