Word 2002 ..IF statement with an OR..There was a listing in here last
week..I
Try Google Groups to find messages.
The building blocks are:
{ =or(expression1,expression2) }
returns 1 if either expression1 or expression2 or both expressions are 1, 0
otherwise
within an = field, or functions can be nested
{ =or(expression1,or(expression2,expression3)) }
When you need to do a comparison, you can use
{ IF "{ MERGEFIELD doc_param }" = "ap.*" "1" "0" }
so then you can do
{ =or( IF "{ MERGEFIELD doc_param }" = "ap.*" "1" "0" },expression2) }
or you can use
{ COMPARE "{ MERGEFIELD doc_param }" = "ap.*" }
which returns 1 for "they match" and 0 for "they do not match", so you can
use
{ =or({ COMPARE "{ MERGEFIELD doc_param }" = "ap.*" },expression2) }
But as long as "False" is always expressed as 0 and "True" is always
expressed as 1 (which is what happens if you do your comparisons using
COMPARE, or IF as above), you can do multiple or s within an = field using
simple addition, e.g.
{ ={ COMPARE "{ MERGEFIELD doc_param }" = "ap.*" }+
{ IF "{ MERGEFIELD doc_param }" = "ap.*" "1" "0" } }
should return 0 if neither expression is true and >0 otherwise.
Often, people want to return one text if one or more of several conditions
is true and another text otherwise. In that case, you usually need to wrap
the whole {=} field up in a final IF, e.g. using the above addition approach
{ IF { ={ COMPARE "{ MERGEFIELD doc_param }" = "ap.*" }+
{ IF "{ MERGEFIELD doc_param }" = "ap.*" "1" "0" } } = 0
"it's all false" "at least one of them is true" }
Peter Jamieson