Referencing Oracle BI System Session variables

Oracle BI (OBIEE) provides multiple categories of Variables, such as:

  • Session
  • Repository
  • Presentation
  • Global

These different categories of variables need to be referenced using a specific syntax. However, the required syntax depends on the category of variable and the context. Below are examples for referencing Session variables in Analysis/Reports and within the narrative View. This is often useful for debugging scenarios or for performing unit test when creating complex formulas.

To reference a Session Variable within a Report use: VALUEOF(NQ_SESSION.GROUP) like below:

image

To reference a Session Variable within a Narrative View use: @{biServer.variables[‘NQ_SESSION.GROUP’]} like below:

image

The complete code to reference the different Session variables (User, Group, Roles) is as follows:


[b]Derzeitiger User:[/b] @{biServer.variables['NQ_SESSION.USER']} [br/][br/]
[b]Derzeitiger Anzeigename:[/b] @{biServer.variables['NQ_SESSION.DISPLAYNAME']} [br/][br/]
[b]Derzeitiger Gruppen:[/b] @{biServer.variables['NQ_SESSION.GROUP']} [br/][br/]
[b]Derzeitiger Rollen:[/b] @{biServer.variables['NQ_SESSION.ROLES']} [br/]

For a exessive list of available Session variables check:

For general Overview check:

For short reference card check:

For Official Documentation check (11g):

Advertisements

Reference variable expressions within Oracle BI Answers

Variables such as System or Session can be referenced witin Oracle BI Answers. To reference a variable with a expression, the following syntax is available for referencing the Login User Name:


@{user.displayName}{default}

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

This can be used within a Narrative View to display information about the current User or Session:

image

The following can be used as example:


[b]User Name:[/b] @{user.displayName}{default} <BR>
[b]User Name:[/b] @{biServer.variables['NQ_SESSION.USER']} <BR>
[b]Roles:[/b] @{biServer.variables['NQ_SESSION.ROLES']} <BR>
[b]Group:[/b] @{biServer.variables['NQ_SESSION.GROUP']} <BR>
[b]Group:[/b] @{biServer.variables['NQ_SESSION.WEBGROUPS']} <BR>

image

For further reference, check the official Documentation:

Tip: Using Row-wise variables and Initialization Blocks

Aside

Tip: Using Row-wise variables and Initialization Blocks

It is often required to use row-wise variables (array’s) to store a list of items. E.g. For the security/visibility it may be required to store the Organization a User has access to. This can be achieved using row-wise variables and Initialization Blocks from OBIEE.

SELECT ‘ActiveOrgs’, OrganizationTable.Name
FROM OrganizationTable
WHERE OrganizationTable.Use = ‘:USER’

This will initialize the Variable ActiveOrgs with the results of the Initialization Blocks. This variable can than be used at other places to filter the respective Organizations.

 

Correct syntax to access variables from Oracle BI Answers

For debugging it can be useful to access session variables of the Oracle BI Server. E.g. to display the current login user Id and the current loglevel of that user:
image

The syntax is not everywhere the same in the Oracle BI Server. The correct syntax to access the variables from Answers is the following:
image

current user: @{biServer.variables['NQ_SESSION.USER']} 
current loglevel: @{biServer.variables['NQ_SESSION.LOGLEVEL']}