Using OR in an IF statement

K

Kathy Webster

I want to say: IF MERGEFIELD region = 1 or IF MERGEFIELD state = 3, then
type "You qualify."

I know how to do it if there is only 1 criteria, but can't figure out the OR
part:

{ IF MERGEFIELD region = 1 "You qualify." }

TIA,
Kathy
 
P

Peter Jamieson

In this case you could use

{ IF { MERGEFIELD region } = 1 "You qualify" "{ IF { MERGEFIELD state } = 3
"You qualify" "" }" }

You can also use { COMPARE }, e.g. if region = 1 then

{ COMPARE { MERGEFIELD region } = 1 }

results in 1 if region = 1 and 0 otherwise. So you can then use

{ IF "{ COMPARE { MERGEFIELD region } = 1 }{ COMPARE { MERGEFIELD state } =
3 }" <> "00" "You qualify" "" }

or if you prefer you can use an { = } field to do either an "or" or a
calculation, then test the result. The approach that is most easily extended
to more conditions is probably

{ IF { ={ COMPARE { MERGEFIELD region } = 1 } + { COMPARE { MERGEFIELD
state } = 3 } } > 0 "You qualify" "" }

All the {} need to be the special field braces that you can insert using
ctrl-F9

Peter Jamieson
 
K

Kathy Webster

Perfect! thank you!
Kathy

Peter Jamieson said:
In this case you could use

{ IF { MERGEFIELD region } = 1 "You qualify" "{ IF { MERGEFIELD state } =
3 "You qualify" "" }" }

You can also use { COMPARE }, e.g. if region = 1 then

{ COMPARE { MERGEFIELD region } = 1 }

results in 1 if region = 1 and 0 otherwise. So you can then use

{ IF "{ COMPARE { MERGEFIELD region } = 1 }{ COMPARE { MERGEFIELD state }
= 3 }" <> "00" "You qualify" "" }

or if you prefer you can use an { = } field to do either an "or" or a
calculation, then test the result. The approach that is most easily
extended to more conditions is probably

{ IF { ={ COMPARE { MERGEFIELD region } = 1 } + { COMPARE { MERGEFIELD
state } = 3 } } > 0 "You qualify" "" }

All the {} need to be the special field braces that you can insert using
ctrl-F9

Peter Jamieson
 

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