WD: Example IF Fields for Print Merging in Word for Windows

ID: Q70131

The information in this article applies to:

The following are examples of IF statements for print merging and the logic for each statement.

1. {if {party}="R" "Republican" "Democrat or Other"}

   If "party" is equal to "R", enter "Republican" (first option is
   positive). If it is not equal to "R", enter "Democrat" or "Other"
   (second option is negative).

2. {name}
   {if{party}<>"R" "" "Republican
   "}{City}

   If "party" is not equal to "R", enter nothing. If "party" is equal
   to "R", enter "Republican". This line will also suppress the blank
   line left by a non-R result.

3. {if{party}="R" "Republican" {if{party"="D" "Democrat"} {if
   {party} ="O" "Other"}}

   If "party" is equal to "R", enter "Republican". If "party" is "D",
   enter "Democrat". If "party" is equal to "O", enter "Other". If
   "party" is none of these, it will be blank.

4. {if{party}="R" "{party}epublican and family" {if{party}="D"
   "{party}emocrat and relatives" {if{party}="O" "{party}ther"}}}

   If "party" is equal to "R" then enter the value of "party" and
   "epublican and family". If "party" is equal to "D" then enter the
   value of "party" and "emocrat and relatives". If "party" is equal
   to "O" enter the value of "party" and "ther". If "party" is not
   "D", "R", or "O", it will be blank.

5. {if{party}="R" {if{name}="George Bush" {if{city}="Washington
   D.C." "President"}}}

   If "party" is equal to "R" and "name" is "George Bush" and "city"
   is "Washington  D.C.", enter "President". If all the conditions
   aren't met leave it blank.

Sample Data Document

NAME,PARTY,CITY George Bush,R,Washington D.C. George McGovern,D,Rapid City Gorgeous George,O,Hollywood King George,K,London

Special Note: Field codes and bookmarks are not case sensitive; for example, NAME would print merge to {naME}. However the results are case sensitive. In these examples if the codes said {if {party}="r" "Republican"} and the data document had the "r" capitalized (R), it would be considered to be a non-r and print nothing.

KBCategory: kbusage KBSubcategory: kbfield kbmerge Additional query words: 6.0 6.0a 6.0c winword2 word6 word7 winword 6.0a 6.0c 7.0 word95 word97

Keywords          : kbualink97 kbusage kbfield kbmerge 
Version           : 1.10 1.10a 2.x 6.0 6.0a 6.0c
Platform          : WINDOWS

Last Reviewed: July 31, 1997