NOMAD/UltraQuest IF Operator Explained
IF Operator - Allows a user to add logic to their DEFINES or expressions.
The information below is from the NOMAD/UltraQuest Reference Manual page 594.
The IF operator tests a logical expression and returns a value based on the value of the logical expression, that is, based on whether the expression is TRUE or FALSE.
IF logical-expression THEN expression1
logical-expression - An expression that resolves to a TRUE or a FALSE condition.
Specifies the expression to execute if the logical expression is TRUE. Expression1 can be any valid 4GL expression. The result of the IF-test operator is the value of this expression if the result of the logical expression is TRUE.
Specifies the expression to execute if the logical expression is FALSE. Expression2 can be any valid 4GL expression. The result of the IF-test operator is the value of this expression if the result of the logical expression is FALSE. Expression1 and expression2 must both have the same data type.
I want to create a new DEFINE (Virtual Field) or expression based on the values of two table columns (fields) ACCOUNT_TYPE that is 3 digits long, 999, and SERVICE_CHARGE that is A1. Based on the value of these two fields I will determine a NEW_ACCOUNT_TYPE.
Possible Values in the Table Columns:
Everything else needs to be set to 750.
DEFINE NEW_ACCOUNT_TYPE AS 999 =
IF ACCOUNT_TYPE EQ 100 AND SERVICE_CHARGE EQ ‘B’ THEN 150
IF ACCOUNT_TYPE EQ 200 AND SERVICE_CHARGE EQ ‘D’ THEN 450
IF ACCOUNT_TYPE EQ 500 AND SERVICE_CHARGE EQ ‘C’ THEN 550
Please contact support if you have any additional questions about the IF operator.
Next week’s topic: ADDATE