Microsoft KB Archive/38875: Difference between revisions

From BetaArchive Wiki
m (Text replacement - "<" to "<")
m (Text replacement - ">" to ">")
Line 17: Line 17:
The following is a sample syntax:
The following is a sample syntax:


<<IF fieldname>&gt;text to print<<ENDIF>&gt;
<<IF fieldname>>text to print<<ENDIF>>


<<IF fieldname>&gt;text to print<<ELSE>&gt;other text to print<<ENDIF>&gt;
<<IF fieldname>>text to print<<ELSE>>other text to print<<ENDIF>>


<<IF fieldname="text to match">&gt;text to print<<ENDIF>&gt;
<<IF fieldname="text to match">>text to print<<ENDIF>>


<<IF fieldname="text to match">&gt;text to print<<ELSE>&gt;other text to print<<ENDIF>&gt;
<<IF fieldname="text to match">>text to print<<ELSE>>other text to print<<ENDIF>>


The following is a sample nested IF syntax:
The following is a sample nested IF syntax:


<<IF fieldname1 > number&gt;&gt;<<IF fieldname2 = &quot;text to match&gt;&gt;text to print<<ELSE>&gt; other text to print<<ENDIF>&gt; <<ENDIF>&gt;
<<IF fieldname1 > number>><<IF fieldname2 = &quot;text to match>>text to print<<ELSE>> other text to print<<ENDIF>> <<ENDIF>>


KBCategory: kbother KBSubcategory: kbmerge Additional reference words: ============================================================================= Copyright Microsoft Corporation 1994.
KBCategory: kbother KBSubcategory: kbmerge Additional reference words: ============================================================================= Copyright Microsoft Corporation 1994.

Revision as of 10:28, 21 July 2020

Using IF, ENDIF, ELSE, Nested IF Instructions in Print Merge

PSS ID Number: Q38875 Article last modified on 11-02-1994

3.x 4.00 5.00

MS-DOS

SUMMARY

The IF instruction is a conditional instruction that you can use to instruct Word to print specific text if a condition is met. The IF instruction must end with an ENDIF. You can also use the ELSE clause to tell Word what to print if the condition is not met.

The IF instruction can also be nested, as long as each IF is matched with an ending ENDIF.

MORE INFORMATION

The following is a sample syntax:

<<IF fieldname>>text to print<<ENDIF>>

<<IF fieldname>>text to print<<ELSE>>other text to print<<ENDIF>>

<<IF fieldname="text to match">>text to print<<ENDIF>>

<<IF fieldname="text to match">>text to print<<ELSE>>other text to print<<ENDIF>>

The following is a sample nested IF syntax:

<<IF fieldname1 > number>><<IF fieldname2 = "text to match>>text to print<<ELSE>> other text to print<<ENDIF>> <<ENDIF>>

KBCategory: kbother KBSubcategory: kbmerge Additional reference words: ============================================================================= Copyright Microsoft Corporation 1994.