OBIEE VariablesVariables:A variable is a symbolic name given to
some known or unknown quantity or information, for the purpose of
allowing the name to be used independently of the information it
represents. A variable name in computer source code is usually
associated with a data storage location and thus also its contents
and these may change during the course of program execution. OBIEE
Variables: It contains values in memory that are used by OBI Server
during processing. It is created and managed using the variable
manager feature in the Administration tool. The Variable Manager
allows you to define variables. The Variable Manager Dialog box has
two panes. The left pane displays a tree that shows variables and
initialization blocks, and the right pane displays details of the
item you select in the left pane.
There are two classes of variables in OBIEE: 1. Repository
Variable 2. Session Variable Repository Variable: A repository
variable has a single value at any point in time. Repository
variables can be used instead of literals or constants in
expression builders in the Administration Tool. The Oracle BI
Server will substitute the value of the repository variable for the
variable itself in the metadata. There are two types of repository
variables: 1. static and 2. Dynamic. Repository variables are
represented by a question mark icon. Static Repository Variable:
The value of a static repository value is initialized in the
Variable dialog box. This value persists, and does not change until
an Oracle BI Administrator decides to change it. EX: Suppose you
want to create an expression to group times of day into different
day segments. If Prime Time were one of those segments and
corresponded to the hours between 5:00 PM and 10:00 PM, you could
create a CASE statement like the following:
CASE WHEN "Hour" >= 17 AND "Hour" < 23 THEN 'Prime Time'
WHEN... ELSE...END where Hour is a logical column, perhaps mapped
to a timestamp physical column using the date-and-time Hour()
function. Rather than entering the numbers 17 and 23 into this
expression as constants, you could use the Variable tab of the
Variable dialog box to set up a static repository variable named
prime_begin and initialize it to a value of 17, and create another
variable named prime_end and initialize it to a value of 23. After
created, variables are available for use in expression builders. In
an expression builder, click on the Repository Variables folder in
the left pane to display all repository variables (both static and
dynamic) in the middle pane by name. Variables should be used as
arguments of the function VALUEOF ( ). For example, the following
CASE statement is identical to the one explained in the preceding
example except that variables have been substituted for the
constants. CASE WHEN "Hour" >= VALUEOF ("prime_begin") AND
"Hour" < VALUEOF ("prime_end") THEN 'Prime Time' WHEN ...
ELSE...END. Step by step process of creating repository variable:
1. From the Administration Tool menu bar, choose Manage >
Variables.
2. In the Variable Manager Dialog box, from the menu bar, choose
Action>New>Repository>Variable.
3. In the Variable dialog box, type a Variable name. Names for
all variables should be unique. The names of system session
variables are reserved and cannot be used for other types of
variables.
In the Variables dialog box, select the type of variable: Static
or Dynamic. And set the default value for the variable where the
spaces available for Default Initialization then click OK.
Where can we use repository variables in obiee: y In BI Server.
y In BI Presentation Services. y In BI Delivers. Dynamic Repository
Variables: Dynamic repository variables are very useful for
defining the content of logical table sources. The values are
refreshed by data returned from queries. When defining a dynamic
repository variable, you will create an initialization block or use
a pre-existing one that contains a SQL query. When the value of a
dynamic repository variable changes, all cache entries associated
with a business model that reference the value of that variable
will be purged automatically.
Step by step process of creating repository variable: y From the
Administration Tool menu bar, choose Manage > Variables. y In
the Variable Manager Dialog box, from the menu bar, choose Action
> New > Session > Variable. y In the Session Variable
dialog box, type a variable name. y In the Variables dialog box,
select the type of variable: Static or Dynamic.
(Dynamic repository variables) Use the Initialization Block
drop-down list to select an existing initialization block that will
be used to refresh the value on a continuing basis. y (Dynamic or
static variables) To add a Default initialize value, perform one of
the following steps: y To use the Expression Builder, click the
ellipsis button to the right of the Default initialize work space.
Type the value into the Default initialize text box. o For static
repository variables, the value you specify in the Default
initializer window persists. It will not change unless you change
it. If you initialize a variable using a character string, enclose
the string in single quotes ( ' ). y Click OK.
Step By Step to create Initialization Block: To create an
initialization block variables perform the following steps: for the
session
1.On the administration page Click on
manage>>Variables>>to open the variable manager.
2.Click On the Session in left pane>>Initialization
Block
3.Right click on the whitespace on the right and select >>
New Initialization block
4.In the session variable initialization block dialog box type
the variable name in the name field.
5.Click the Edit Data Source button to open the session variable
initialization block Data Source dialog box
6.Click on the Browse button and select Connection Pool in the
select connection pool dialog box.
7.Double click on the connection pool or click the select button
to add the connection pool to the session variable initialization
block data source dialog box.
8.In the Default initialization string field type the
initialization Query to initialize variable.
9.Click ok to choose the session variable initialization block
data source dialog box. The initialization string is available is
visible in the session variable initialization block dialog
box.
10.Then click on the Edit Data Target to open the session
variable initialization block variable target dialog box.
11.Click New to open the session variable dialog box .
12.In the name field type the Variable name.
13. Click ok to Close the Session Variable Dialog box. 14.Click
yes when prompted about the user session variable having a special
purpose. 15.The newly created variable added to the session
variable initialization block variable target dialog box.
Session Variable: Session variables are like dynamic repository
variables in that they obtain their values from initialization
blocks. Unlike dynamic repository variables, however, the
initialization of session variables is not scheduled. When a user
begins a session, the Siebel Analytics Server creates new instances
of session variables and initializes them. Unlike a repository
variable, there are as many instances of a session variable as
there are active sessions on the Siebel Analytics Server. Each
instance of a session variable could be initialized to a different
value.
Syntax for referencing session variables The syntax for
referencing session variables is as follows: @
{NQ_SESSION.VariableName} For example, @ {NQ_SESSION.USER}
NQ_SESSION - indicates that this item references a session
variable. Variable Name - a reference to an object available in the
current session context. For example: USER. Session variables are
variables that the Oracle BI Server and Oracle BI Presentation
Services use for specific purposes. Session variables have reserved
names that cannot be used for other kinds of variables. For
Example, if we want to pass the current login Managers id to the
dashboard, we can set the session variable as
NQ_SESSION.USER_DETAILS as the filter condition in the report.
Session variables are like dynamic repository variables in that
they obtain their values from initialization blocks. Unlike dynamic
repository variables, however, the initialization of session
variables is not scheduled. When a user begins a session, the
Siebel Analytics Server creates new instances of session variables
and initializes them. Unlike a repository variable, there are as
many instances of a session variable as there are active sessions
on the Siebel Analytics Server. Each instance of a session variable
could be initialized to a different value.
Session variables are primarily used when authenticating users
against external sources such as
database tables or LDAP servers. If a user is authenticated
successfully, session variables can be used to set filters and
permissions for that session. For a discussion of the use of
session variables in setting up security, see Security in Siebel
Analytics.
System session variables: System session variables are session
variables that the Siebel Analytics Server and Siebel Analytics Web
Server 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). For information about using the GROUP system
session variable in conjunction with the SA System subject area to
provide group membership and external email addresses to Siebel
Delivers, see Setting up the Repository to Work with Siebel
Delivers. NOTE: When you use these variables for Siebel Analytics
Web, preface their names with NQ_SESSION. For example, to filter a
column on the value of the variable LOGLEVEL set the filter to the
Variable NQ_SESSION.LOGLEVEL. USER holds the value the user enters
as his or her logon name. GROUP Contains the groups that the user
belongs to. These are used by both the Siebel Analytics Server and
Siebel
Analytics Web Server. When a user belongs to multiple groups,
separate the group names with semicolons. Do not delimit text (for
example, do not surround the text with single or double quotes).
Use a Varchar column in a database table to contain the group
memberships. For example, if a user belonged to groups called Sales
US, Sales UK, QA and Dev, and Doc, the text entered into a Varchar
data type column in a database table would be: Sales US; Sales
UK;QA and Dev; Doc Note: The Siebel Analytics Web administrator
needs to make sure that the names of Web groups are different from
any user IDs who will log on to Siebel Analytics Web. If a user and
a Web group share the same name, the user will receive an Invalid
Account message when attempting to log on to Siebel Analytics Web.
DISPLAYNAME Used for Siebel Analytics Web. It contains the name
that will be displayed to the user in the greeting in the Web
interface. It is also saved as the author field for catalog
objects. For internal Siebel Analytics Server repository users (non
database users), this variable is populated with the user's full
name. PORTALPATH Used for Siebel Analytics Web. It identifies the
default dashboard the user sees when logging in (the user can
override this preference after logged on).
LOGLEVEL The value of LOGLEVEL (a number between 0 and 5)
determines the Logging level that the Siebel Analytics Server will
use for the user's queries. This system session variable overrides
a variable defined in the Users object. If the Administrators Users
object has a Logging level defined as 4 and the session variable
LOGLEVEL defined in the repository has a default value of 0 (zero),
the value of 0 applies. WEBGROUPS Specifies additional groups
specific to Siebel Analytics Web, if any. The use of Web groups
provides a mechanism for more granular Web content control.
REQUESTKEY Used for Siebel Analytics Web. Any users with the same
nonblank request key will share the same Web cache entries. This
tells Siebel Analytics Web that these users have identical content
filters and security in the Siebel Analytics Server. Sharing Web
cache entries is a way to minimize unnecessary communication with
the server. SKIN Determines certain elements of the look and feel
of the Siebel Analytics Web interface. The user can alter some
elements of the user interface by picking a style when logged on to
the Web. The SKIN variable points to a Siebel Analytics Web folder
that contains the non alterable elements (for example, graphics
such as GIF files). Such directories begin with sk_. For example,
if a folder were
called sk_companyx, the SKIN variable would be set to companyx.
EMAIL Contains the user's default email address for use with Siebel
Answers. If the delivery feature of Siebel Answers is enabled, an
email device using this address will be created for the user upon
first log in. Users can override this address by changing their
account settings in Siebel Analytics Web. Non System Session
Variable: Non-system variables are application-specific variables
created by an Administrator. System and non system variables are
represented by a question mark icon in the Variable Manager. To
initialize non system session variable Create a new initialization
block or else use initialization block which you were created
before. To create new initialization block follow the steps in
which I have created early in this blog.