Post date: 12-Mar-2013 03:32:15
Session Variables #
A session variable is initialized at login time for each user. When a user begins a session, the BI Server creates a new instance of a session variable and initializes it.
There are as many instances of a session variable as there are active sessions on the BI Server. Each instance of a session variable could be initialized to a different value.
There are two types of session variables:
- System — A session variable that the BI Server and BI Presentation Services use for specific purposes.
System session variables have reserved names that cannot be used for other kinds of variables (such as static or dynamic repository variables and non-system session variables).
- Non-system — A system variable that the administrator creates and names. For example, the administrator might create a SalesRegion non-system variable that initializes the name of a user’s sales region.
The administrator creates non-system session variables using the Oracle BI Administration Tool.
Repository Variables #
A repository variable is a variable that has a single value at any point in time.
There are two types of repository variables:
- Static — Repository variables whose value persist and do not change until the administrator decides to change them.
- Dynamic — Repository variables whose values are refreshed by data returned from queries.
The administrator creates repository variables using the Oracle BI Administration Tool.
Presentation Variables #
A presentation variable is a variable that you can create as part of the process of creating one of the following types of dashboard prompts:
- Column prompt — A presentation variable created as part of a column prompt is associated with a column, and the values that it can take come from the column values.
To create a presentation variable as part of a column prompt, in the “New Prompt dialog” (or Edit Prompt dialog), you have to select Presentation Variable in the Set a variable field and then enter a name for the variable in the Variable Name field.
- Variable prompt — A presentation variable created as part of a variable prompt is not associated with any column, and the Admin define the values that it can take.
To create a presentation variable as part of a variable prompt, in the “New Prompt dialog” (or Edit Prompt dialog), select Presentation Variable in the Prompt for field and then enter the variable name in the Variable Name field.
The value of a presentation variable is populated by the column or variable prompt with which it was created. That is, each time a user selects a value in the column or variable prompt, the value of the presentation variable is set to the value that the user selects.
Request Variables #
A request variable allow overriding the value of a session variable but only for the duration of a database request initiated from a column prompt. A request variable can be created as part of the process of creating a column prompt.
A request variable that is created as part of a column prompt is associated with a column, and the values that it can take come from the column values.
To create a request variable as part of a column prompt, in the “New Prompt dialog” (or Edit Prompt dialog), select Request Variable in Set a variable field and then enter the name of the session variable to override in the Variable Name field.
The value of a request variable is populated by the column prompt with which it was created. That is, each time a user selects a value in the column prompt, the value of the request variable is set to the value that the user selects. The value, however, is in effect only from the time the user presses the Go button for the prompt until the analysis results are returned to the dashboard.
Where Can I Reference Variables? #
Variables can be referenced in the following areas (but not all types of variables can be referenced in each area):
- Title views.
- Narrative views.
- Static text views.
- Filters.
- Column formulas.
- Conditional formatting conditions.
- Table and column headings in analyses.
- Direct database requests.
- Dashboard prompts and inline prompts.
- Headers and footers for PDF output.
- Link or image objects in a dashboard.
- Text objects in a dashboard.
- Graphs to specify conditional formatting of graph data.
- Gauge thresholds.
- Gauge limits.
- Agents.
- Actions to specify parameters.
- Conditions to specify parameters.
- Selection steps.
- KPIs to define thresholds.
- KPIs included in a KPI watchlist.
- URL fields in dialogs.
Syntax for Referencing Variables
Variables can be used 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 1.
Note:
In the syntax, if the “at” sign (@) is not followed by a brace ({), then it is treated as an “at” sign.
Table 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. | @{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.
Table 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”) | 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} |