conditional if statements

S

Smokey smith

I am producing a marketing letter that will go to a range of organisations. I
have a field in the data table that identified the organisationtype and use
syntax similar to
{if {MERGEFIELD organisationtype} = "school" "then insert this text" 'else
insert this text."}

When I run the merge I get the the field code but not the text I want. What
am I doing incorrectly?
 
C

Charles Kenyon

Try:
{IF "{MERGEFIELD organisationtype}" = "school" "true text" "false text."}

I've found that putting the quotation marks around the merge field makes IF
fields work better. May be superstition on my part, I haven't tested it in
years. I just do it.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
P

Peter Jamieson

Are the {} all the special field braces you can get by pressing ctrl-F9?

Does the result of the organisationtype MERGEFIELD exactly match "school"
(all lower case etc.) ?

Peter Jamieson
 
P

Peter Jamieson

I've found that putting the quotation marks around the merge field makes
IF fields work better. May be superstition on my part, I haven't tested it
in years. I just do it.

It's a good defensive programming practice, particularly sice the "field
language" is not comprehensively specified. There are definitely occasions
when it makes a difference - there have been one or two examples in the
group in the past few months but I forget exactly what they were :)

Peter Jamieson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top