Using If Statement and Alphanumeric data...

J

jperleevt

I'm trying to use a nested IF statement to look at a field and return a
different value depending on the value. I have no problem that I know
of creating the actual IF statement. My problem comes from the fact
that my data is Alphanumeric....

06SUBOT should return Summer 2006
FA2006 should return Fall 2006
2007SP should return Spring 2006
07SUBOT should return Summer 2007
MSSU06 should return Summer 2006

Are all examples of data that maybe in my source document, which is a
comma/quoted text file.

I dumbed it down to just a single IF statement and it still fails....

{IF {MERGEFIELD c77CcAltr11} = "06MAFW" "Summer 2006" "NOT Summer
2006"}

It works fine for the data that starts w/ letters but messes up on the
ones that start w/ numbers.

I found this article...
http://support.microsoft.com/default.aspx?scid=kb;en-us;97484
...which seems to say I'm screwed, although it is for Word97.

I'm using Word 2003 sp 2.

Anyone have any ideas? Changing my data is most likely not possible as
it is coming from another system and getting passed into a Word doc. In
the furture my users will use consistent names that start w/ alpha but
I need to come up w/ some sort of solutions as they can't easily change
what they have already done as it impact other systems as well.

Thanks for any assistance you can provide.

Jen
 
P

Peter Jamieson

Yes, there are some problems with matching certain values.

My suggestions:
a. make sure you fully quote the operands in the IF. I would do the
punctuatin and spacing as follows, although the quotes around the field name
really are only necessary if the name has spaces or whatever in it:

{ IF "{ MERGEFIELD "c77CcAltr11" }" = "06MAFW" "Summer 2006" "NOT Summer
2006" }
b. assuming that isn't enough (I don't think it will be), force the
operands to start with a letter instead of a digit, e.g.

{ IF "A{ MERGEFIELD "c77CcAltr11" }" = "A06MAFW" "Summer 2006" "NOT Summer
2006" }

My best bet anyway...

Peter Jamieson
 
J

jperleevt

Thanks Peter!
I did a small test at home and it worked! I'll try it tomorrow in my
actual document.

:)

Jen
 
J

jperleevt

After a lot of futsing around I got the whole thing to work. Thanks so
much again!
 

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