ELSEIF

Designates a conditional test and conditions that are performed if the preceding IF test generates a value of FALSE. For this reason, multiple ELSEIF commands are allowed following a single IF.

Syntax

ELSEIF( condition ) statement ; [ ...statement ; ]
ELSEIF | ELSE | ENDIF
Parameter Description

condition

Formula or function that returns a Boolean value of TRUE (a nonzero value) or FALSE (a zero value).

statement

Those operations that are to be performed in the event that the IF test (including the ELSE command) produces a FALSE, or 0, result.

Notes

  • The ELSEIF command must be used in conjunction with an IF command.

  • You do not need to end ELSEIF statements with ENDIF statements. Only IF statements should be ended with ENDIF statements. For example:

         IF (condition)
             statement;
             IF (condition)
                statement;
             ELSEIF (condition)
                    statement;
             ENDIF;
          statement;
          ENDIF;

Example

The following example is based on the Sample Basic database. This calculation script tests to see if the current member in the Market dimension is a descendant of West or East. If so, Essbase multiplies the value for Marketing by 1.5. The calculation script then tests to see if the current member is a descendant of South. If so, Essbase multiplies the value for Marketing by .9. If the current member is not a descendant of West, East, or South, Essbase multiplies the value for Marketing by 1.1.

IF (@ISMBR(@DESCENDANTS(West))
         OR 
    @ISMBR(@DESCENDANTS(East))
       )
    Marketing = Marketing * 1.5;
ELSEIF(@ISMBR(@DESCENDANTS(South))
    )
    Marketing = Marketing * .9;
ELSE 
    Marketing = Marketing * 1.1;
ENDIF;

See Also