Click Next when you have finished creating calculations. When the repository is open in online mode, the Checkout screen appears. In The Finish screen displays a summary of the calculations that will be created. If Click Finish. The new calculation column

Using Expression Builder and Other Utilities 17-17 ■ The lower left pane shows special cases that are available for the selected calculation. You can keep the default values, or specify how you want the special cases to be handled. For example, for the Change calculation, you can choose whether to return NULL or some other value when the comparison column is NULL. Select a calculation in the upper right pane to view and set special cases for that calculation. ■ The lower right pane shows the resulting SQL for the selected calculation. Figure 17–6 New Calculations Screen of Calculation Wizard

5. Click Next when you have finished creating calculations.

6. When the repository is open in online mode, the Checkout screen appears. In

online mode, objects need to be checked out before you can make changes to them. Click Next to check out the necessary objects.

7. The Finish screen displays a summary of the calculations that will be created. If

you want to make changes, click Back, or select a particular step from the navigation panel.

8. Click Finish. The new calculation columns are created.

17-18 Metadata Repository Builders Guide for Oracle Business Intelligence Enterprise Edition 18 Using Variables in the Oracle BI Repository 18-1 18 Using Variables in the Oracle BI Repository You can use variables in a repository to streamline administrative tasks and dynamically modify metadata content to adjust to a changing data environment. There are two classes of variables: repository variables and session variables. ■ A repository variable has a single value at any point in time. There are two types of repository variables: static and dynamic. ■ Session variables are created and assigned a value when each user logs on. There are two types of session variables: system and nonsystem. Initialization blocks are used to initialize dynamic repository variables, system session variables, and nonsystem session variables. You can use the Variable Manager in the Administration Tool to define variables. The Variable Manager dialog 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. Repository variables and system and nonsystem session variables are represented by a question mark icon. The icon for an initialization block is a cube labeled i. This chapter contains the following topics: ■ About Repository Variables ■ Creating Repository Variables ■ About Session Variables ■ Creating Session Variables ■ Working with Initialization Blocks About Repository Variables A repository variable has a single value at any point in time. Repository variables can be used instead of literals or constants in Expression Builder in the Administration Tool. The Oracle BI Server substitutes the value of the repository variable for the variable itself in the metadata. Caution: Values in repository and session variables are not secure, because object permissions do not apply to variables. Anybody who knows or can guess the name of the variable can use it in an expression in Answers or in a Logical SQL query. Because of this, do not put sensitive data like passwords in session or repository variables. 18-2 Metadata Repository Builders Guide for Oracle Business Intelligence Enterprise Edition This section contains the following topics: ■ About Static Repository Variables ■ About Dynamic Repository Variables About Static Repository Variables The value of a static repository variable is initialized in the Variable dialog. This value persists, and does not change until an administrator decides to change it. For example, 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 HourtimeExpr function. Rather than entering the numbers 17 and 23 into this expression as constants, you could use the Variable tab of the Variable dialog 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. Static repository variables must have default initializers that are either numeric or character values. In addition, you can use Expression Builder to insert a constant as the default initializer, such as Date, Time, and TimeStamp. You cannot use any other value or expression as the default initializer for a static repository variable. In previous releases, the Administration Tool did not limit the values of default initializers for static repository variables. Because of this, if your repository has been upgraded from a previous release, you may see warnings in the Consistency Checker similar to the following: The variable, Current Month does not have a constant default initializer. If you see warnings similar to this, update the relevant static repository variables so that the default initializers have constant values. About Dynamic Repository Variables 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 create an initialization block or use a preexisting one that contains a SQL query. You also set up a schedule that the Oracle BI Server will follow to execute the query and periodically refresh the value of the 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 are purged automatically. Each query can refresh several variables: one variable for each column in the query. You schedule these queries to be executed by the Oracle BI Server. Dynamic repository variables are useful for defining the content of logical table sources. For example, suppose you have two sources for information about orders. One source contains recent orders and the other source contains historical data. Using Variables in the Oracle BI Repository 18-3 You need to describe the content of these sources on the Content tab of the Logical Table Source dialog. Without using dynamic repository variables, you would describe the content of the source containing recent data with an expression such as: Orders.OrderDates.Order Date = TIMESTAMP 2001-06-02 00:00:00 This content statement becomes invalid as new data is added to the recent source and older data is moved to the historical source. To accurately reflect the new content of the recent source, you would have to modify the fragmentation content description manually. Dynamic repository values can be set up to do it automatically. Another suggested use for dynamic repository values is in WHERE clause filters of logical table sources, defined on the Content tab of the Logical Table Source dialog. A common use of these variables is to set filters for use in Oracle BI Presentation Services. For example, to filter a column on the value of the dynamic repository variable CurrentMonth, set the filter to the variable CurrentMonth. Creating Repository Variables This section explains how to create repository variables. To create a repository variable: 1. In the Administration Tool, select Manage, then select Variables. 2. In the Variable Manager dialog, select Action New Repository Variable. 3. In the Variable dialog, type a name for the variable. Names for all variables should be unique. The names of system session variables are reserved and cannot be used for other types of variables.

4. Select the type of variable: Static or Dynamic.