The conditional statement is an IF/ELSE clause that tells the Transformer how to process data. IF statements set conditions that are defined using attribute names, operators, functions, and attribute values. To specify an action within the condition, use RUN/SET statements. Always close an IF statement with ENDIF.
Keyword
The following table lists the keywords in the conditional statements.
Keyword | Description |
---|---|
IF | (Required) Begins a statement. When conditions are True, the RUN/SET statements following the IF keyword are executed. |
ELSEIF | (Optional) When IF conditions are False, the ELSEIF condition is evaluated. |
ELSE | (Optional) When IF or ELSEIF conditions are False, the RUN/SET statements following the ELSE keyword are executed. |
RUN | (Optional) Precedes action commands. |
SET |
(Optional) Precedes assignment commands. |
ENDIF | (Required) Closes a conditional statement. |
IF/ELSE/ENDIF Syntax
Use the following IF/ELSE/ENDIF syntax to build a conditional statement. You create a condition using the operators and functions.
where function1 through function4 indicate the action to perform. IF statements can also be nested as shown below:
RUN Statements
The RUN statements specify a function to perform. When the condition is True, the RUN statements following IF are executed. When the condition is False, the RUN statements following ELSEIF and/or ELSE are executed. The valid functions for the RUN statements are CHARACTER_TRANSLATION, FIELD_SCANNING, and TABLE_RECODING.
The RUN statement is defined by:
- Function names or subroutines as defined in the settings file
- Entry ID (list of entries) to be executed. When you call multiple functions, use hyphens to indicate ranges or commas to separate items and run them in sequence. Example: RUN TABLE_RECODING(3-5), RUN FIELD_SCANNING(1,6)
SET Statements
The SET statements specify an assignment to complete. When the condition is True, the SET statements following IF are executed. When the condition is False, the SET statements following ELSEIF and/or ELSE are executed.
The SET statement takes the following as arguments:
- Schema attribute names
- Equal sign assignments operator (=)
- Value or attribute data arithmetic
Example