Conditional content and ‘short IF Fields’ (IF THEN ELSE)

Document automation enables you to insert or remove content in your documents to produce a tailored end result.

ZumeForms lets you do this in 3 main ways:

  • IF Fields;
  • ‘Short’ IF Fields; and
  • MergeText.

This article discusses short IF fields.

A short IF Field is useful for inserting short pieces of conditional content. They are also handy for dealing with singular and plural content, e.g. ‘a Party” and “the Parties”, depending on how many parties are involved.

The If Field compares two values and then inserts the text appropriate to the result of the comparison. It uses the syntax of If Then Else.

To use the If Field in a template, do the following:

  1. On the Insert tab, in the Text group, click Quick Parts, and then click Field.
  2. In the Field names list, select If.
  3. In the Field codes box, type the expressions, operator, true text, and false text, following the syntax shown below.
  4. Click OK.

The syntax is:

{ IF “Expression1” Operator “Expression2″ “TrueText” “FalseText”}

You can use a mergefield with form data as Expression1, Expression2 or in the TrueText or FalseText.

You can build up the short IF Field as follows:

Insert a Word field into your document using the insert field command (or fn+cmd+F9 on a Mac, of just CTRL+F9 on a PC):

{ }

Then add a mergefield into the field. You link the mergefield with the relevant form field by inserting the name of the form field – in this case ‘Field_yn’:

{ IF {MERGEFIELD Field_yn }  }

Then you can insert your conditions:

{ IF “{MERGEFIELD Field_yn }” = “true” “YES” “NO” }

What happens here is if ‘Field_yn’ equals ‘true’ then YES will be inserted into the document. Whereas if Field_yn is ‘false’ then NO will be inserted.

Another example is with singular and plural content. The following example uses the count of the repeat section ‘Parties_rpt’ to determine the content that is inserted:

{ IF {MERGEFIELD Parties_rpt_Count } > 1 “the Parties” “the Party”  }

You can even use other mergefields as the content that is inserted into the document as the TrueText or FalseText. The following IF Statement will insert no content if Country_cho is Australia, or it will insert the name of the country if Country_cho is any other country. This sort of IF Statement is useful if you only want to insert the name of the country when it is NOT Australia:

{ IF “{MERGEFIELD Countries_cho }” = “Australia” “” “{MERGEFIELD Country_cho}” }

More about the syntax

If the Expressions may contain spaces, use quotes around the Expressions:

{ IF “Expression1” Operator “Expression2″ “TrueText” “FalseText”}

If the Expressions will be numerical values, don’t use quotes around the Expressions:

{ IF Expression1 Operator Expression2 “TrueText” “FalseText”}

Note: A field code tells the field what to show. Field results are what is shown in the document after having evaluated the field code.


Expression1, Expression2

Values that you want to compare. These expressions can be mergefields from your form, bookmark names, strings of characters, numbers, nested fields that return a value, or mathematical formulas.

If an expression contains spaces, enclose the expression in quotation marks. It is a good idea to do this by default, because you don’t know what the user will enter on the form.


  • Expression2 must be enclosed in quotation marks so that it is compared as a character string.
  • If the operator is = or <>, Expression2 can contain a question mark (?) to represent any single character or an asterisk (*) to represent any string of characters.
  • If you use an asterisk in Expression2, the portion of Expression1 that corresponds to the asterisk and any remaining characters in Expression2 cannot exceed 128 characters.


Comparison operator. Insert a space before and after the operator.

=Equal to
<>Not equal to
>Greater than
<Less than
>=Greater than or equal to
<=Less than or equal to

TrueText, FalseText

Text that results when the comparison is true (TrueText) or false (FalseText). If FalseText isn’t specified and the comparison is false, the IF field has no result. Each string containing multiple words must be enclosed in quotation marks.


The following example specifies that if the customer order is greater than or equal to 100 units, the text “Thanks” appears in the document. If the customer order is fewer than 100 units, the text “The minimum order is 100 units” appears in the document.

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

NOTE: You need to have a space each side of the operator. The content needs to be surrounded with double-quotes. If you want to specify no content, then you use two double-quotes with nothing inside.