2 conditions, or 'like' condition?

L

Leslie Isaacs

Hello All

I need to have some text in my document that depends on
whether the merge field 'type_name' starts with the
word 'NURS'. i.e if type_name is Nurse Practitioner or
Nursing auxilliary or Nurse locum etc etc etc I
want "clinical" otherwise I want "Administrative"

How do I do that? I have tried the help files, which
suggested nesting 2 if statements (so type_name>nt and
type_name<nv), but couldn't get it to work. Is there
a 'like' operator that I could use with a wildcard, so
something like

{IF {MERGEFIELD type_name} like "nurs"
& "*" "Clinical" "Administrative"}

Hope someone can help!

Many thanks
Leslie Isaacs
 
C

Cindy M -WordMVP-

Hi Leslie,

If you can't add this information in your data source
(which you unfortunately don't mention). And no, Word
doesn't support "Like". Closest you can get is a COMPARE
field; you'll want to read up on it in the Help, and do
note that it is case-senstive. Here's an exmaple

{ IF { Compare "{ Mergefield type_name }" = "Nurs*" } = 0
"Administration" "clinical" }
I need to have some text in my document that depends on
whether the merge field 'type_name' starts with the
word 'NURS'. i.e if type_name is Nurse Practitioner or
Nursing auxilliary or Nurse locum etc etc etc I
want "clinical" otherwise I want "Administrative"

How do I do that? I have tried the help files, which
suggested nesting 2 if statements (so type_name>nt and
type_name<nv), but couldn't get it to work. Is there
a 'like' operator that I could use with a wildcard, so
something like

{IF {MERGEFIELD type_name} like "nurs"
& "*" "Clinical" "Administrative"}

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
G

Guest

Cindy
Many thanks for your reply. The example you gave in fact
worked a treat without my even having to read up
the 'Help' - although I have spent some time there so that
I understand the syntax.
Thanks again
Les.
NB. my data source is an access mdb.
 
C

Cindy M -WordMVP-

Many thanks for your reply. The example you gave in fact
worked a treat without my even having to read up
the 'Help' - although I have spent some time there so that
I understand the syntax.
NB. my data source is an access mdb.
Glad it worked for you :)

Note that, given Access, I'd have probably chosen to do this
in an "expression" in an Access query. Since Access supports
wildcards and other functions Word does not have, it's often
more efficient. Plus, if you're going to need it often, you
only have to do it the one time and can re-use the query for
other merges.

The expression could look something like this:

TypeOfJob: IIF(Left([type_name],
4)="nurs","clinical","admin")

TypeOfJob would then show up in your datasource as a merge
field.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep
30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :)
 

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