A conditional expression assigns a value based on the result of a logical expression. The assigned value can be numeric or alphanumeric. A conditional expression takes the following form: |
Reference: | Example: |
IF expression1 THEN expression2 [ELSE expression3]
Note:
Conditional expressions operate on numeric, alphanumeric, and Boolean values and assign the result based on a conditional test. You can use the following operators in a conditional expression:
Operator |
Description |
IF | Establishes a conditional test. |
THEN | Specifies the action to perform if the result of a conditional test is TRUE. |
ELSE | Specifies the action to perform if the result of a conditional test is FALSE. |
This example calculates the values of a virtual field (BLANK_NAME) using a conditional expression; the following report evaluates the expression and displays the values of the virtual field accordingly.
BANK_NAME/A20 = IF BANK_NAME EQ ' ' THEN 'NONE'
ELSE BANK_NAME;
You can define a virtual field with a "true" condition and then refer to it as TRUE or FALSE in your report request.
For example, the report below evaluates a virtual field called MYTEST using the following expression:
MYTEST=(CURR_SAL GE 11000) OR (DEPARTMENT EQ 'MIS');
The report request then evaluates the condition set for MYTEST and displays the fields CURR_SAL and DEPARTMENT (sorted by EMP_ID) only if MYTEST is true.
Note: TRUE and FALSE conditions are valid only in the IF phrase.