Skip to main content
A newer version of this page is available. .

IF

  • 2 minutes to read

IF

Mixed field

{ IF Value-1 Operator Value-2 field-argument-1 field-argument-2 }

Compares the values designated by Value-1 and Value-2, using the operator designated by Operator. Value-1 and Value-2 can be literals or merge fields. For example, the field code

{IF {MERGEFIELD Order} >= 100 “Thanks” “The minimum order is 100 units” }

specifies that if the customer order is greater than or equal to 100 units, the result is “Thanks”; but if the customer order is fewer than 100 units, the result is “The minimum order is 100 units”.

You can use the IF field with MERGEFIELD fields. The following statement illustrates this. If the current data record contains different values in HomeAddress and CompanyAddress fields, RichEditControl prints the value of the PresidentName field that is the first set of text in quotation marks. Otherwise, it prints the second set of text in quotation marks that is the value of the OwnerName field.

{ IF {MERGEFIELD CompanyAddress} <> {MERGEFIELD HomeAddress} “{MERGEFIELD PresidentName}” “{MERGEFIELD OwnerName}” }

Important

Do not use the IF field in headers or footers if the condition is based on the PAGE and NUMPAGES field values. The field value can be incorrect due to limitations of the current layout calculation.