Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / July 2006

Tip: Looking for answers? Try searching our database.

how to make multiple "if...then...else" fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DonnaRae - 13 Jul 2006 19:56 GMT
{IF {MERGEFIELD State} = "MA" "mass distributor contact info" "company
salesperson info"}

How do I add more "ifs" to this? I need to add about 20 states, and the
alternate text is always "company salesperson info". Does that have to go at
the end of each "if", or will it work if it is placed just at the end of all
the "ifs"?

Thanks,

Donna
Peter Jamieson - 13 Jul 2006 20:42 GMT
It depends.

First, it's generally easier to see what's going on if you use alt-F9 to
toggle between "field display" and "field results display", and use ctrl-F9
to insert each pair of the special field code braces {}.

If state = MA
then "mass distributor contact info for MA"
else  "company salesperson info for MA"

then I suggest you use something like

{ IF "{ MERGEFIELD state }" = "MA"
"mass distributor contact info for MA"
"company salesperson info for MA"
}{ IF "{ MERGEFIELD state }" = "NY"
"mass distributor contact info for NY"
"company salesperson info for NY"
}

and so on for each state.

If what you need is

If state = MA
then "mass distributor contact info for MA"
else  if state = "NY"
then "mass distributor contact info for NY"
etc. and if state isn't any of those 20 states , then
"company salesperson info"

then you could try something like

{ SET cspi "N"
}{ IF "{ MERGEFIELD state }" = "MA"
"mass distributor contact info for MA"
"{ SET cspi "Y" }"
}{ IF "{ MERGEFIELD state }" = "NY"
"mass distributor contact info for NY"
"{ SET cspi "Y" }"
}{ IF cspi = "N"
""
"company salesperson info" }

Each pair of () needs to be the field code braces you can isert using
ctrl-F9.

I have a feeling I haven't quite got that right but have a go and see what
happens.

Peter Jamieson

> {IF {MERGEFIELD State} = "MA" "mass distributor contact info" "company
> salesperson info"}
[quoted text clipped - 9 lines]
>
> Donna
DonnaRae - 14 Jul 2006 19:41 GMT
The second option that you gave is what I need, but I don't understand it.
{ SET cspi "N -- What does that mean?

Donna

> It depends.
>
[quoted text clipped - 61 lines]
> >
> > Donna
Peter Jamieson - 14 Jul 2006 23:06 GMT
cspi is just a variable name (in fact, it's a Word "bookmark" name) I
invented. It stands for "company sales person info". You can use any valid
bookmark name (more or less).

A { SET } field assigns a value to a bookmark/variable. You can then access
the value using

{ REF cspi }

or

{ cspi }

But there's an error at the end of my suggestion. It should be

{ IF "{ REF cspi }" = "N"
""
"company salesperson info" }

Peter Jamieson
> The second option that you gave is what I need, but I don't understand it.
> { SET cspi "N -- What does that mean?
[quoted text clipped - 70 lines]
>> >
>> > Donna

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.