The IF / ELSE functions are two (2) functions that work together to perform conditional processing based on one (1) or more values being evaluated. The IF function tests for a true (1) condition. The ELSE function tests for a false (0) condition. Connect CDC (SQData) functions can be performed when a condition(s) meets the criteria for an IF and/or ELSE function.
Note: The IF function can be used without the ELSE function, but the ELSE function cannot be used without the IF.
Category
Specialized
Syntax
IF condition, { true_action [, true_action] } ELSE { false_action [, false_action] }
Parameters and Descriptions
Parameter | Description |
---|---|
condition | One (1) or more conditions to be tested by the IF function. A condition can be any Connect CDC (SQData) function that returns a true (1) or false (0) value. |
true_action | This parameter specifies one (1) or more actions to be taken if the condition(s) evaluated is true (1). A true_action is usually another Function or nested Function. |
false_action | One (1) or more actions to be taken if the condition(s) evaluated is false (0). A false_action is usually another Function or nested Function. Notes "? It is important to use Connect CDC (SQData) Boolean functions that return a true (1) or false (0) value as the condition within an IF function. Otherwise, the result will always be false." "? It is recommended that you keep each keyword, condition and action on separate lines in the Connect CDC (SQData) command script to improve readability." |
Example
Terminate the Connect CDC (SQData) execution with a Return Code (RC=8) if a CDC record is read that indicates a source record was Deleted.
IF CDCOP(CDCIN) = 'D'
{
OUTMSG(8,'A Delete has been detected and is not permitted')
}