WD: Example IF Fields for Print Merging in Word for Windows
ID: Q70131
|
The information in this article applies to:
-
Microsoft Word for Windows, versions 1.1, 1.1a, 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
-
Microsoft Word for Windows 95, versions 7.0, 7.0a
-
Microsoft Word 97 for Windows
The following are examples of IF statements for print merging and the
logic for each statement.
{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).
{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.
{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.
{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.
{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.
Additional query words:
6.0 winword2 word6 word7 winword 7.0 word95 word97
Keywords : kbualink97 kbusage kbfield kbmerge
Version : WINDOWS:1.1,1.1a,2.0,2.0a,2.0a-CD,2.0b,2.0c,6.0,6.0a,6.0c,7.0,7.0a,97
Platform : WINDOWS
Issue type :
|