The <<if...>> function provides the if-then-else logic to the SDML. This is the most common decision making mechanism within any language. The <<if>> function receives a single argument, which it evaluates as being either true or false. If the argument is true, its first expression, trueExpression, is returned. Otherwise, the falseExpression value is returned. This expression must be preceded by the keyword else. falseExpression is optional and if it is not present, the else keyword cannot appear either.
This function can be used to return something as basic as a single word, or as complex as an entire SQL statement. The contents of either expression can contain SDML text as well. In the case where there is no else portion, and the boolArg is false, the return value of the <<if...>> function is an empty string.
- <<if boolArg
“trueExpression” [else “falseExpression”]>>
- boolArg The value to be evaluated as either true or false. May be a Boolean data tag or the Boolean return value of function call. If this argument is a Boolean data tag, the tag should be entered by name, excluding the tag markers (<< and >>) to return the Boolean value of that property, rather than the text value.
- trueExpression Required expression containing the value to be returned by the function when boolArg is true. This expression must be enclosed in double quotes.
- falseExpression Optional expression containing the value to be returned by the function when boolArg is false. This expression must be preceded by the keyword else and the expression itself must be enclosed in double quotes.