About Session Variables
Use a session variable when you need a variable with a value specific to a user's session and is set when a user logs into Oracle Analytics. Use session variables to set filters and permissions for the session.
Session variables dynamically modify metadata content to adjust to a changing data environment. For example, suppose User1 belongs to Department1 and User2 belongs to Department2. These users must access only the data for their respective departments. In this case you can create and use the DEPARTMENT_NUMBER variable to store the appropriate values for User1 and User2. You can then use this variable to filter data by Department2 for User1 and Department2 for User2.
To define a session variable, you create or use an existing initialization block to contain one or more session variables. The initialization block contains a default initialization query and connection pool to access the data source and return results to populate the session variables that you define. The session variables are then available for you to add to the semantic model's data filters or expressions.
Unlike global variables, the initialization of session variables isn't scheduled. When a user begins a session, Oracle Analytics creates new instances of session variables and initializes them. Session variable values remain unchanged for the duration of the session.
There are as many instances of a session variable as there are active sessions on Oracle Analytics. You can initialize each instance of a session variable to a different value.
Initialization blocks that contain many session variables can slow performance. You can defer the processing of session variable initialization blocks during session logon until their associated session variables are actually accessed within the session. See Defer Session Variable Processing.