WD: SET Fields Within IF Field Evaluate Incorrectly

Article ID: 97791 - View products that this article applies to.
This article was previously published under Q97791
Expand all | Collapse all

SYMPTOMS

When you use an IF field to determine how to set a bookmark, and you use SET fields inside the IF field, the bookmark being set always evaluates as the second SET statement.

For example, these statements
      {ask gender "What is the person's gender?"}
 -->  {if gender = f {set pronoun she}{set pronoun he}}
      {ref pronoun}
				
always show the bookmark "pronoun" as "he." This is because Word evaluates fields from the inside out, and from left to right. It evaluates the first SET statement, and the bookmark "pronoun" is set to "she." It then evaluates the next SET field, and the bookmark "pronoun" is reset to "he." When the IF instruction is carried out, both the true bookmark and the false bookmark are "he."

WORKAROUND

The correct way to use these fields together is to put the IF field inside the SET field, as in the following example:
      {ask gender "What is the person's gender?"}
 -->  {set pronoun {if gender = f "she" "he"}}
      {ref pronoun}
				

Properties

Article ID: 97791 - Last Review: August 16, 2005 - Revision: 2.2
APPLIES TO
  • Microsoft Word 2.0 Standard Edition
  • Microsoft Word 2.0a
  • Microsoft Word for Windows 2.0b
  • Microsoft Word 2.0c
  • Microsoft Word 6.0 Standard Edition
  • Microsoft Word 6.0a
  • Microsoft Word 6.0c
  • Microsoft Word 95 Standard Edition
  • Microsoft Word 95a
  • Microsoft Word 6.0 for Macintosh
  • Microsoft Word 6.01 for Macintosh
  • Microsoft Word 6.01 for Macintosh
  • Microsoft Word 98 for Macintosh
Keywords: 
kbfield kbprb KB97791
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback