Conditional Tests
You can define Essbase formulas that use a conditional test or a series of conditional tests to control the flow of calculation. In conjunction with the flow commands, you can use Boolean functions that return TRUE or FALSE (1 or 0, respectively) based on the result of the test.
The IF and ENDIF commands define a conditional block. The formulas between the IF and the ENDIF commands are executed only if the test returns TRUE (1). If the test returns FALSE (0), you can use the ELSE and ELSEIF commands to specify alternative actions. The formulas following each ELSE command are executed only if the previous test returns FALSE (0). Conditions following each ELSEIF command are tested only if the previous IF command returns FALSE (0).
When you use a conditional formula in a calculation script, enclose it in parentheses and associate it with a member in the database outline, as shown in the examples in this section.
In conjunction with an IF command, you can use functions that return TRUE or FALSE (1 or 0, respectively) based on the result of a conditional test. These functions are known as Boolean Functions.
Use Boolean functions to determine which formula to use. The decision is based on the characteristics of the current member combination. For example, to restrict a certain calculation to the members in the Product dimension that contain input data, preface the calculation with an IF test based on @ISLEV(Product,0).
If one of the function parameters is a cross-dimensional member, such as @ISMBR(Sales -> Budget), all of the parts of the cross-dimensional member must match the properties of the current cell to return a value of TRUE (1).
The following Boolean functions specify conditions:
Table 17-3 List of Boolean Functions That Test Conditions
Function | Condition |
---|---|
Current member has a specified accounts tag (for example, an Expense tag) |
|
Current member is an ancestor of the specified member |
|
Current member is an ancestor of the specified member, or the specified member itself |
|
Current member is a child of the specified member |
|
Current member is a child of the specified member, or the specified member itself |
|
Current member is a descendant of the specified member |
|
Current member is a descendant of the specified member, or the specified member itself |
|
Current member of the specified dimension is in the generation specified |
|
Current member of the specified dimension is in the level specified |
|
Current member matches any of the specified members |
|
Current member is the parent of the specified member |
|
Current member is the parent of the specified member, or the specified member itself |
|
Current member (of the same dimension as the specified member) is in the same generation as the specified member |
|
Current member (of the same dimension as the specified member) is in the same level as the specified member |
|
Current member is a sibling of the specified member |
|
Current member is a sibling of the specified member, or the specified member itself |
|
A specified UDA exists for the current member of the specified dimension |
When you place formulas on the database outline, you can use only the IF, ELSE, ELSEIF, and ENDIF commands and Boolean functions to control the flow of the calculations. You can use additional control commands in a calculation script.
For information about how to develop calculation scripts and how to use them to control how Essbase calculates a database, see Develop Calculation Scripts for Block Storage Cubes.