COMPARE
Syntax:
COMPARE Expression-1 Operator Expression-2
Expression-1:expression
Expression-2:expression
AND
and OR
functions in a formula, and then by using the result of the formula in an IF
field. Operator can be any one of the six relational and equality operators specified for operator (§2.16.3.3).
If Operator is =
or <>
, Expression-2 can contain a question mark (?) to represent any single character, or an asterisk (*) to represent any string of characters. The expression shall be enclosed in quotation marks so that it is compared as a character string. If an asterisk is used in Expression-2, the portion of Expression-1 that corresponds to the asterisk, plus any remaining characters in Expression-2, shall NOT exceed 128 characters.
Field Value: 1 if the comparison is true, or 0 if the comparison is false.
Switches: None.
{ IF { = OR ( { COMPARE { MERGEFIELD CustomerNumber } >= 4 }, { COMPARE { MERGEFIELD CustomerRating } <= 9 } ) } = 1 "Credit not acceptable" "Credit acceptable"}
The following COMPARE
field results in the value 1 if any value in the PostalCode
data field is the range 98500–98599:
{ COMPARE "{ MERGEFIELD PostalCode }" = "985*" }