Domain: Conversion functions
The TRANSLATE-BOOLEAN( ) function checks whether the input expression is true or false. If it is true, the value specified in the THEN clause is supplied as the result. If the input expression is not true (= false), the value specified in the ELSE clause is supplied.
Format
TRANSLATE-BOOLEAN( ) |
IF =expression1 ,THEN =expression2 ,ELSE = expression3 |
Result type
BOOLEAN / INTEGER / STRING
Input parameters
IF = expression1
Designates a BOOLEAN expression.
THEN = expression2
Designates a BOOLEAN, INTEGER or STRING expression.
ELSE = expression3
Designates a BOOLEAN, INTEGER or STRING expression.
Result
String, if the expression in the THEN/ELSE clause is a string expression.
Integer, if the expression in the THEN/ELSE clause is an arithmetic expression.
TRUE / FALSE if the expression in the THEN/ELSE clause is a Boolean expression.
Error messages
No error messages
Example
/A = 6 /B = 5 /C = TRANSLATE-BOOLEAN(IF=(A > B), THEN='A greater', ELSE='B greater') /SHOW-VARIABLE C C = A greater /A = 5 /B = 6 /C = TRANSLATE-BOOLEAN(IF=(A > B), THEN='A greater', ELSE='B greater') /SHOW-VARIABLE C C = B greater