Create an Initialization Block for Session Variables


Create an Initialization Block for Session Variables

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, Oracle BI 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 Oracle BI Server. Each instance of a session variable could be initialized to a different value.
A session is an instance of a user running the client application. The session starts when the application is started and ends when the application is exited.
To create an initialization block for session variables, perform the following steps:
1.Return to the SH repository, which should still be open in online mode in the Administration Tool.
2.Click Manage > Variables to open the Variable Manager.

3.Click Session > Initialization Blocks.

4.Right-click in the white space on the right and select New Initialization Block.

5.In the Session Variable Initialization Block dialog box, type setUser in the Name field.

6.Click the Edit Data Source button to open the Session Variable Initialization Block Data Source dialog box.

7.Click the Browse button and select SH > Connection Pool in the Select Connection Pool dialog box.

8.Double-click Connection Pool or click the Select button to add the connection pool to the Session Variable Initialization Block Data Source dialog box.

9.In the Default Initialization String field, type the following initialization string:
select ':USER', case when upper(':USER') = 'KURT' then 'Germany' when upper(':USER') = 'KEIKO' then 'Japan' when upper(':USER')= 'CHARLES' then 'United Kingdom' when upper(':USER') = 'KAREN' then 'United States of America' end, 'CountryManagers', 2 from Dual


10.Click OK to close the Session Variable Initialization Block Data Source dialog box. The initialization string is visible in the Session Variable Initialization Block dialog box.

11.Click Edit Data Target to open the Session Variable Initialization Block Variable Target dialog box.

12.Click New to open the Session Variable dialog box.

13.In the Name field, type USER.

14.Click OK to close the Session Variable dialog box.
15.Click Yes when prompted about the USER session variable having a special purpose.

16.The USER variable is added to the Session Variable Initialization Block Variable Target dialog box.

17.Repeat the steps and add three more variables: UserCountryGROUP, and LOGLEVEL. Click Yes when promoted about the GROUP and LOGLEVEL session variables having a special purpose. The order is important. The order of the variables must match the order of the values for the variables in the initialization string in the initialization block.

18.Click OK to close the Session Variable Initialization Block Variable Target dialog box. The variables are displayed in the Variable Target section of the Session Variable Initialization Block dialog box.

19.Click OK to close the Session Variable Initialization Block dialog box. The setUser initialization block is visible in the Security Manager.

20.Click Action > Close to close the Variable Manager.
21.Check in changes.
22.Save the repository.


No comments:

Post a Comment

Popular Posts