Vous êtes sur la page 1sur 25

For beginners and New Developers

Variables

Use repository variables to setup constant

values that can be used anywhere such as


CURRENT_MONTH, CURRENT_YEAR
Set them up in repository under Manage>Variables

Repository Variable
A repository variable has a single value at any

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.
We will create a new static variable called
CURRENT_YEAR and set it to 2008

Repository Variable
Open the RPD file paintnew
Go to Admin tool and choose Manager-

>Variable
Once the variable manger is launched
Choose New->Repository->Variable
Name it as CURRENT_YEAR and Type =
Static
Default Value 2008

Static Variable

Static Variable
Now Save the Repository and start the

services using start button under Core


application
Now login to Analysis and build a new report
Choose Greg Year, Dollars Columns
Add a filter on this report on Greg Year Column
Under Value in New Filter window choose
Add More options drop down box and pick
Repository Variable

Static Variable

Static Variable

Static Variable
Results shows only year 2008 data

Repository Variable Dynamic


You initialize dynamic repository variables in
the same way as static variables, but 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
You will also set up a schedule that the Oracle
BI server will follow to execute the query and
periodically refresh the value of the variable

Dynamic Variable

Stop the services under Core application


Open the RPD file in Admin tool
Create a new repository Dynamic variable
By choosing Manage->Variables
In Variable Manager Choose
Action->New->Repository->Variable

Dynamic Variable

Dynamic
In the new window Choose Variable type as

Dynamic
Click on New button to create a new
initialization block
Name new block as CURMTH_BLOCK

Dynamic Variable

Dynamic Variable
Click on Edit Data Source button
In the new window click on Use Database Specific
SQL option
On the left hand side window single click on Default
Type the sql
Select calendar_month_desc from time_d
Where trunc(greg_dt) = trunc(sysdate-1500)
Click on the Browse button below next to
connection pool and in the new window choose the
only pool name

Dynamic Variable

Dynamic Variable

In the variable target section click on Edit

Data Target
In the new window click on CURRENT_MONTH
Variable

Dynamic Variable
Click on the Test button at the bottom to see

the results

Dynamic Variable
Click on Close and then OK
Now close the Dynamic repository variable

too
Save the RPD file
Start the services under coreapplication

Dynamic Variable
In analysis create a new report with following

columns Calendar Month Desc and Dollars


Put in a filter with variable CURRENT_MONTH
and you should see only the results belong to
a month in 2008

Session Variable
Session variables are similar to 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 Oracle BI
Server creates new instances of session
variables and initializes them

Session Variables
Unlike a repository variable, 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.
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.

Session Variable
Two types System session variable, Non-

System Session variable


System session variables are session
variables that the BI server and BI
presentation services use for specific
purposes
System session variables have reserved
names, that can not be used for other kinds of
variables (such as static or dynamic repository
variables and non system variables) Example:
USER, DISPLAYNAME

Non System Session


A common use for non system session
Variable
variables is setting user filters. For example,
you could define a nonsystem variable called
SalesRegion that would be initialized to the
name of the users sales region
You could then set a security filter for all

members of a group that would allow them to


view only data pertinent to their region.

Presentation Varibale
A presentation varibale must be declared in a

dashboard prompt(Using the Set Variable field)


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
It can be referred anywhere in answers such as
titles, filters etc
It will be visible in Dashboard pages depending
up on the scope of the dashboard prompt

Vous aimerez peut-être aussi