IF prompt statement

Use the IF statement to evaluate whether a condition is TRUE or FALSE, and perform specified actions based on the result.

Conditions can be grouped to form complex conditions using the operators AND, OR, and (unary) NOT.

The IF statement is always paired with a THEN keyword to specify the action to be performed when the condition is true. Optionally, an ELSE or ELSEIF keyword can follow the THEN keyword to specify the action to be performed when the condition is false.

The IF statement is ended by ENDIF.

Syntax



Note: Arithmetic operations are not supported inside conditions. For example,
 IF variable < (10 * 5) THEN ...

is not legal. The following is legal and produces the intended result:

  temp_variable = 10 * 5
  IF variable < temp_variable THEN ...

Examples

IF A > 10 THEN
.
.
.
ELSEIF A < 3 THEN
.
.
.
ELSEIF ( B = A AND C <= 20) OR ( X != Y ) THEN

.
.
.
ENDIF
temp_num = 10 * 5
IF A < temp_num THEN
.
.
.
ENDIF

Procedure

Use the following procedure to define an IF statement:

  1. Selecting the IF statement: Click Statements —> Conditional. Blueworx Voice Response displays the Conditional Definition window.
  2. Click the button next to IF condition THEN.
  3. If the statement is to test when the condition is not true, click the NOT push button.
  4. Defining the condition: To define the condition, either type it in the condition field or click condition. Blueworx Voice Response displays the Condition Definition window.
  5. In the Condition Definition window:
    • Type the name of the left operand variable in the Left Operand field, or click Left Operand to display the Term Definition window to select the operand.
    • Click the push button next to Operator, then select the appropriate comparison operator.
    • Type the name of the right operand variable in the Right Operand field, or click Right Operand to display the Term Definition window to select the operand.
  6. Click OK. Blueworx Voice Response displays the Conditional Definition window again with the defined condition in the condition field.
  7. If required, click AND and click AND or OR. Repeat this procedure, starting from Step 3.
  8. Adding the IF statement to the prompt: Click OK, Blueworx Voice Response adds the IF statement to the prompt.
  9. Defining THEN statements: Use the Statements menu to define the statement that you want to execute when the IF condition is true.

    The statement is added to the prompt following the THEN keyword.

  10. Repeat Step 9 for each action to be performed when the IF condition is true.
  11. Defining ELSE or ELSEIF keywords: If the statement requires actions to be performed only when the IF condition is false, click Statements —> Conditional.

    In the Conditional Definition window, click the button next to either:

    • ELSE to define actions to be performed when the IF condition is false.
    • Or, ELSEIF condition THEN to define another IF statement structure to be performed when the initial IF condition is false.
  12. Defining an ELSEIF structure: To define an ELSEIF structure, repeat this procedure starting from Step 3.

    The statements are added to the prompt following the ELSEIF keyword.

  13. Adding ELSE or ELSEIF to the prompt: Click OK.

    The ELSE or ELSEIF keyword is added to the prompt.

  14. Defining ELSE statements: Use the Statements menu to define the ELSE statements that you want to execute when the IF condition and all ELSEIF conditions are false.

    The statements are added to the prompt following the ELSE keyword.