Reply
 
Thread Tools Display Modes
  #1   Report Post  
Bill Anderson
 
Posts: n/a
Default MERGE: Can I have multiple SET statements based on one IF

Based on a field in my merge data I am trying to set multiple variables like:

If {MERGEFIELD ProgStatus} = "AD"
then {Set Variable1 "FoundIt"}
{Set Variable2 {MERGEFIELD AcadProgram} }
{Set Variable3 {MERGEFIELD AdmitTerm} }
otherwise
{Set Variable1 "Not Found"}
{Set Variable2 "" }
{Set Variable3 "" }

something like that. Or must I set up 3 separate IF tests like:
{If {MERGEFIELD ProgStatus} = "AD" {Set Variable1 "FoundIt"} {Set Variable1
"Not Found"} }

{If {MERGEFIELD ProgStatus} = "AD" {Set Variable2 {MERGEFIELD AcadProgram} }
{Set Variable2 ""} }

{If {MERGEFIELD ProgStatus} = "AD" {Set Variable3 {MERGEFIELD AdmitTerm} }
{Set Variable3 ""} }

Thanks in advance for any help.
  #2   Report Post  
Graham Mayor
 
Posts: n/a
Default

You can put them all in the same conditional field. Note the positions of
the quote marks.

{ IF{ Mergefield ProgStatus} = "AD" "{ Set Variable1 "FoundIt" }{ Set
Variable2 "{ Mergefield AcadProgram }" }{ Set Variable3 "{ Mergefield
AdmitTerm }"}" "{ SET Variable1 "Not Found" }{ Set Variable2 "" }{ Set
Variable3 "" }"}

The results are placed with REF fields.

This seems to work OK with test data using your field names.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Bill Anderson wrote:
Based on a field in my merge data I am trying to set multiple
variables like:

If {MERGEFIELD ProgStatus} = "AD"
then {Set Variable1 "FoundIt"}
{Set Variable2 {MERGEFIELD AcadProgram} }
{Set Variable3 {MERGEFIELD AdmitTerm} }
otherwise
{Set Variable1 "Not Found"}
{Set Variable2 "" }
{Set Variable3 "" }

something like that. Or must I set up 3 separate IF tests like:
{If {MERGEFIELD ProgStatus} = "AD" {Set Variable1 "FoundIt"} {Set
Variable1 "Not Found"} }

{If {MERGEFIELD ProgStatus} = "AD" {Set Variable2 {MERGEFIELD
AcadProgram} } {Set Variable2 ""} }

{If {MERGEFIELD ProgStatus} = "AD" {Set Variable3 {MERGEFIELD
AdmitTerm} } {Set Variable3 ""} }

Thanks in advance for any help.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MERGE: Can I have multiple SET statements based on one IF Bill Anderson Mailmerge 0 February 24th 05 01:27 AM
Switch an image dynamically based on mail merge field - possible? Chris Hlusak Mailmerge 1 January 24th 05 11:11 PM
Using Hyperlinks in Mail Merge IF...THEN...ELSE Statements Mark V Mailmerge 8 November 30th 04 01:31 PM
Need multiple Ifs in Merge Fields Pat Cortez Mailmerge 1 November 30th 04 01:11 AM
Merge multiple documents? George M. Lutz New Users 1 November 27th 04 01:06 PM


All times are GMT +1. The time now is 02:27 PM.

Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright 2004-2023 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"