View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default creating a nested if...then...else rule

You don't have to do it with /nested/ fields - the following would work
because cand_type could only have one of the four values in any given
record. Assuming it's a merge field, you would have

{ IF "{ MERGEFIELD cand_type }" = "I" "insert this text string"
}{ IF "{ MERGEFIELD cand_type }" = "J" "insert this text string"
}{ IF "{ MERGEFIELD cand_type }" = "V" "insert this text string"
}{ IF "{ MERGEFIELD cand_type }" = "U" "insert this text string" }

The precise layout isn't very important as long as you don't put any
characters between the final } of one IF and the starting { of the next,
butall the {} have to be the special field braces you can insert with
ctrl-F9, and you can use Alt-F9 to toggle between field code view and
field results view.

You could also consider

{ SET s "insert this text string"
}{ IF "{ MERGEFIELD cand_type }" = "I" "{ s }"
}{ IF "{ MERGEFIELD cand_type }" = "J" "{ s }"
}{ IF "{ MERGEFIELD cand_type }" = "V" "{ s }"
}{ IF "{ MERGEFIELD cand_type }" = "U" "{ s }" }

If I,JV and U might actually be i, j, v or u you can do

{ SET s "insert this text string"
}{ IF "{ MERGEFIELD cand_type \*Upper }" = "I" "{ s }"
}{ IF "{ MERGEFIELD cand_type \*Upper }" = "J" "{ s }"
}{ IF "{ MERGEFIELD cand_type \*Upper }" = "V" "{ s }"
}{ IF "{ MERGEFIELD cand_type \*Upper }" = "U" "{ s }" }

Peter Jamieson

http://tips.pjmsn.me.uk

On 25/02/2010 21:28, wrosie wrote:
I need to create a nested rule that will pull up data this way:

If cand_type = I or if cand_type = J or if cand_type = V or if cand_type = U
then insert this text string.

I know there's a way to do it with additional sets of quotation marks, but I
haven't done this for 10 years or so. I'd be very grateful for some help.
Thanks!