If then Else mail merge field

R

ram

HI

Is there a way to evaluate 3 condition with the if then else field option.

I would like Field 4 to look at fields 1-3 and give me the value of the
field the has a Yes. In the example below the vlaue of Field3 would be
populated in Field 4

Field1 No
Field2 No
Field3 Yes

Thanks for any help
 
P

Peter Jamieson

Your requirement is a bit ambiguous because if you want the value of the
field that has value "Yes", the value is always going to be "yes".

If ou actually want to put the /name/ of the field whose value is "Yes"
into a variable you can work with, then you could use something like

{ IF "{ MERGEFIELD Field1 }" = "Yes" "{ SET myField4 "Field1" }" ""
}{ IF "{ MERGEFIELD Field2 }" = "Yes" "{ SET myField4 "Field2" }" ""
}{ IF "{ MERGEFIELD Field3 }" = "Yes" "{ SET myField4 "Field3" }" ""
}

If more than one of Field1, Field2, Field3 has the value "Yes" then the
above code would set myField4 to the field with the highest number (e.g.
if all are "Yes", myField4 would be set to "Field3"

You could reference myField4 using

{ REF myField4 }

This assumes that
a. your Field1,Field2, Field3 are merge fields
b. the "Yes" value is always precisely "Yes" - if it could be "YES"
etc. then you would be better off with

{ IF "{ MERGEFIELD Field1 \*Upper }" = "YES" "{ SET myField4 "Field1" }"
"" }

or some such

But that result does not look particularly useful to me either - maybe
you want to set myfield4 to some other value depending on which of
Field1, Field2, Field3 is "yes" ? If so, perhaps you can spell it out.


Peter Jamieson

http://tips.pjmsn.me.uk
 
R

ram

Thank You this was very helpful

Peter Jamieson said:
Your requirement is a bit ambiguous because if you want the value of the
field that has value "Yes", the value is always going to be "yes".

If ou actually want to put the /name/ of the field whose value is "Yes"
into a variable you can work with, then you could use something like

{ IF "{ MERGEFIELD Field1 }" = "Yes" "{ SET myField4 "Field1" }" ""
}{ IF "{ MERGEFIELD Field2 }" = "Yes" "{ SET myField4 "Field2" }" ""
}{ IF "{ MERGEFIELD Field3 }" = "Yes" "{ SET myField4 "Field3" }" ""
}

If more than one of Field1, Field2, Field3 has the value "Yes" then the
above code would set myField4 to the field with the highest number (e.g.
if all are "Yes", myField4 would be set to "Field3"

You could reference myField4 using

{ REF myField4 }

This assumes that
a. your Field1,Field2, Field3 are merge fields
b. the "Yes" value is always precisely "Yes" - if it could be "YES"
etc. then you would be better off with

{ IF "{ MERGEFIELD Field1 \*Upper }" = "YES" "{ SET myField4 "Field1" }"
"" }

or some such

But that result does not look particularly useful to me either - maybe
you want to set myfield4 to some other value depending on which of
Field1, Field2, Field3 is "yes" ? If so, perhaps you can spell it out.


Peter Jamieson

http://tips.pjmsn.me.uk
 

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