Oracle® Business Intelligence Answers, Delivers, and Interactive Dashboards User Guide > Basics of Working with Requests in Oracle BI Answers >

Using Variables to Display Values in Request Results, Dashboards and iBots


You can reference a session variable, repository variable (e.g. User.displayName), or a presentation variable, and use its value in request results, dashboards and iBots. For more information about variables, see Oracle Business Intelligence Server Administration Guide. This section contains the following topics:

What are session variables, repository variables, and presentation variables?

Session and repository variables are pre-defined values held on the server (e.g. NQ_SESSION.System.currentTime). A presentation variable must be declared in a dashboard prompt (using the Set Variable field), and its name and value are determined by the user, either when it is initially declared, or when it is referenced in request results, dashboards and iBots.

For more information about declaring presentation variables in a dashoard prompt, see Creating a Dashboard Prompt for Filtering Oracle BI Requests.

The following examples suggest how you might reference a session variable or a presentation variable:

  • Example 1 - Referencing a session variable

    To enable an author to display the current user's name in a report title view, the author simply adds a reference to the session variable @{NQ_SESSION.User.displayName} to the report title view. This session variable displays the current user name in the title view.

  • Example 2 - Referencing a presentation variable

    Where a dashboard report displays a prompt for a single region, the author would like to display the region selected by the user in the title of the dashboard report. To do so, the author simply adds a reference to a presentation variable in the report title for example, @{variables.myFavoriteRegion}. The presentation variable (myFavoriteRegion) needs to have been declared for the dashboard prompt. This presentation variable displays whatever region has been entered by the user in this dashboard prompt.

Where can you reference variables?

You can reference variables in the following areas:

  • Title Views
  • Narrative Views
  • Column Filters
  • Column Formulas
  • Conditional Formatting conditions (presentation variables only)
  • Direct Database Requests
  • Dashboard prompts

    Users will be prompted for a variable value which is then set into a request (session) variable and passed to the Oracle BI server.

  • Chart scale markers.
  • Gauge range settings.
  • Static text.
  • iBot Headlines and text

What is the syntax for referencing session variables?

The syntax for referencing session variables is as follows:

@{NQ_SESSION.variableName}

For example, @{NQ_SESSION.dashboard.description}

  • NQ_SESSION - indicates that this item references a session variable.
  • variableName - a reference to an object available in the current session context. For example: dashboard.description.

What is the syntax for referencing repository and presentation variables?

The syntax for referencing repository and presentation variables is as follows:

    • @{<variableName>}{<value>}[format] - for repository variables

      For example, @{dashboard.path} - inserts the path to the current dashboard.

    • @{variables.<variableName>}{<value>}[format] - for presentation variables

      For example, @{variables.myFavoriteRegion}{Central} - inserts the value of the presentation variable myFavoriteRegion.

      • variables - prefix that is required when you reference a presentation variable in a request.
      • variableName - a reference to an object available in the current evaluation context. For example: @{variables.myFavoriteRegion}.
      • value - (optional) - a constant or variable reference indicating a value to be used if the variable referenced by the variableName isn't populated (is undefined).
      • format - (optional) - a format mask dependent on the data type of the variable. For example: #,##0, MM/DD/YY hh:mm:ss, and so on.

        NOTE:  If the @ sign is not followed by a {, it will be treated as an @ sign. For more information, see Editing the Appearance of Column Contents in Oracle BI Answers.

What pre-defined variables can be referenced in request results, dashboards and iBots?

The following table contains a list of pre-defined variables that can be referenced in request results, dashboards, and iBots.

Table 7.
Object
Variable
Example

System

productVersion
currentTime

system.productVersion = 10.1.3.2 (Build 091506.1900)
system.currentTime = 2006-9-21 14:1:35

Session

locale
language
rtl
timeZone
loginTime
logoutTime
lastAccessTime
currentUser

session.locale = en-gb
session.language = en
session.rtl = false
session.timeZone = Unknown Time Zone
session.loginTime = 2006-9-21 14:0:17
session.logoutTime = 2006-9-21 16:0:17
session.lastAccessTime = 2006-9-21 14:01:35
session.currentUser = administrator

User

id
displayName
homeDirectory

user.id = administrator
user.displayName = administrator
user.homeDirectory = /users/administrator

Dashboard

currentPage
xml

dashboard.currentPage = test page name
dashboard.xml = the dashboard XML

Oracle® Business Intelligence Answers, Delivers, and Interactive Dashboards User Guide Copyright © 2007, Oracle. All rights reserved.