You are on page 1of 24

VARIABLES IN OBIEE

OBIEE offers 3 types of variables: 1. Repository variable 2. Session variable 3. Presentation variable REPOSITORY VARIABLE: A repository variable is a BI server variable that doesn't depend of the user (then of the login process). You have two kind of repository variable :
y y

Static (of a constant) Dynamic (which is calculated/refresh periodically).

DYNAMIC REPOSITORY VARIABLE: 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. Steps: Create a dynamic repository variable that obtains the minimum year. We will need to write an initialization block to get initialize and update this variable. 1. In the Administration tool. Click on Manage-> variables.

2. Click on Action-> New -> Repository -> Variable.

3. Give 'MinYear' as the name of the variable. Select the radio button that says Dynamic. The Initialization block variable drop down will be enabled. 4. In the initialization block variable click on New. A window for creating a new initialization block opens.

5. Write 'MinYearInit' as the name of the block. Refresh interval one minute. Start on - leave default.

6. Click on edit datasource and enter the following query : SELECT MIN(CALENDAR_YEAR) FROM TIMES

7. Click on browse button near the 'Connection pool' and select the connection pool.

8. Click on 'Test'. Results should show the minimum year. 9. Click on OK.

10. In the initialization dialog, click on edit data target. Select the MinYear variable and click on OK.

11. Close the initialization dialog by clicking OK.

12. Close the dynamic repository dialog by clicking OK.

We have now created a repository variable that obtains the minimum year from the database. Check in the changes. 13. Open the Presentation services. 14. To add the variable to a narrative text, add the text dashboard object to the dashboard. click on properties of the text object and write [b]Minimum Year- @{biServer.variables['MinYear']}[/b]

The output will be :

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. Example: Suppose you want to create an expression that displays the default year 2000 for certain products. Rather than entering the number 200 in this expression as constant, you could use the Variable tab of the Variable dialog box to set up a static repository variable named def_year and initialize it to a value of 2000. Steps: Create a static repository variable to store the default year. We will need to write an initialization block to get initialize and update this variable. 1. In the Administration tool. Click on Manage-> variables.

2. Click on Action-> New -> Repository -> Variable.

3. Give 'def_year' as the name of the variable. Select the radio button that says Static.

4. In the default initializer , enter the value 2000.

5. Close the dynamic repository dialog by clicking OK.

We have now created a repository variable that stores the minimum year from the database. Check in the changes. 13. Open the Presentation services. 14. To add the variable to a narrative text, add the text dashboard object to the dashboard. Click on properties of the text object and write [b]Default Year- @{biServer.variables['def_year']}[/b]

The output will be :

Even you can use this static variable in expressions created using expression builder in rpd.

SESSION VARIABLES: Session Variable are the second type of variable and depend of the user. When the users log in BI Presentation Service, they are initialized. You have two kind of session variable: 1. Session System: System session variables are session variables that the Oracle BI Server and Oracle 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 variable and nonsystem session variables). 2. Session Non System: Session Non System variable are variable that you can create for your own purpose. Example: Suppose if you want to display the name of that customer alone who logged into the presentation services using his first name. This is a type of datalevel security. Steps: Create a session variable to store the details of the users logging into the presentation services. We will need to write an initialization block to get initialize and update this variable. 1. In the Administration tool. Click on Manage-> variables.

2. Click on Action-> New -> Session-> Variable.

3. Give USER' as the name of the variable. The Initialization block variable drop down will be enabled. In the initialization block variable click on New.

4. A window for creating a new initialization block opens. Write 'setUser' as the name of the block.

5. Click on edit datasource and enter the following query: SELECT ':USER FROM CUSTOMERS WHERE CUST_FIRST_NAME=':USER'

6. Click on browse button near the 'Connection pool' and select the connection pool. Click OK.

7. In the initialization dialog, click on edit data target. Select the USER variable and click OK.

11. Close the initialization dialog by clicking OK.

12. One Dialog box opens and aska for YES or NO. Click YES and close the session variable dialog

13. In the BMM layer, open the LTS of COUNTRIES table. Click on the content tab.

14. In the WHERE clause filter, give the following statement: sh."".SH.CUSTOMERS.CUST_FIRST_NAME = VALUEOF(NQ_SESSION."USER") OR VALUEOF(NQ_SESSION."USER") = 'Administrator'

15. Click ok. Check in the changes. Restart the services. 16. Log in the presentation services using any of the customer first names (e.g. Abel)

17. In Answers, in the criteria tab select CUST_FIRST_NAME and display the result.

PRESENTATION VARIABLE: The presentation variable is the only variable offer by the presentation service. You can set it with the help of the dash board prompt which will then take the data type of the presentation column. The syntax of presentation variable is @{variables.<variable Name>}{<default>}[format] Steps: 1. Go to the Criteria tab of Answers in presentation services. Select the Calendar Year, Country, Products, Sales Facts

2. Display the results. In the result tab, drill down the list and Select the Title.

3. Give the Syntax on Title Box Country Is: @{Country} Give the Syntax on Subtitle Year is :@{Year}

4. Select the compound layout

5. Go to criteria tab. Click add filter button in CALENDAR_YEAR. Select the is prompted option. Click on OK.

6. Do the same for COUNTRY_NAME .

7. Save the request.

8. Click the new dashboard prompt. Select the SH subject area.

9. Right Side select the Calendar Year.

10. Open set variable drill down list and select the Presentation variable.

11. Given the Year on presentation variable.

12. Do the same for the COUNTRY_NAME.

13. Save the Prompts.

14. Select the Dashboard and click the page Option. Edit Dashboard and select Saved Prompt and the request.

15. Select the year and country and click on GO.

You might also like