#1   Report Post  
JCSadie
 
Posts: n/a
Default OR statement

Need Syntax. I keep getting a syntax error.
  #2   Report Post  
Peter Jamieson
 
Posts: n/a
Default

Can you be a bit more specific please? What do you want to "OR" ?

Peter Jamieson
"JCSadie" wrote in message
...
Need Syntax. I keep getting a syntax error.



  #3   Report Post  
Graham Mayor
 
Posts: n/a
Default

Perhaps if you explained exactly what it is you are trying to do, someone
may be able assist with the correct syntax.

--

Graham Mayor - Word MVP

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




JCSadie wrote:
Need Syntax. I keep getting a syntax error.



  #4   Report Post  
JCSadie
 
Posts: n/a
Default

Word 2002 ..IF statement with an OR..There was a listing in here last week..I
should have saved it out.

{if {=or({mergefield doc_param} = "ap,*"), =or({mergefield doc_param} =
"ap&pop,*")} = 1 "Blah Blah Blah" "?????????"}

Not sure it should be = 1 for True. Did this because I was thinking of the
AND conditional. Where do you end the parenthesis? Do you add the second =or
after a , or a ;? Enough? That is what I meant by needing syntax!

"Graham Mayor" wrote:

Perhaps if you explained exactly what it is you are trying to do, someone
may be able assist with the correct syntax.

--

Graham Mayor - Word MVP

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




JCSadie wrote:
Need Syntax. I keep getting a syntax error.




  #5   Report Post  
Peter Jamieson
 
Posts: n/a
Default


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 a

{ =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

"JCSadie" wrote in message
...
Word 2002 ..IF statement with an OR..There was a listing in here last
week..I
should have saved it out.

{if {=or({mergefield doc_param} = "ap,*"), =or({mergefield doc_param} =
"ap&pop,*")} = 1 "Blah Blah Blah" "?????????"}

Not sure it should be = 1 for True. Did this because I was thinking of
the
AND conditional. Where do you end the parenthesis? Do you add the second
=or
after a , or a ;? Enough? That is what I meant by needing syntax!

"Graham Mayor" wrote:

Perhaps if you explained exactly what it is you are trying to do, someone
may be able assist with the correct syntax.

--

Graham Mayor - Word MVP

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




JCSadie wrote:
Need Syntax. I keep getting a syntax error.








  #6   Report Post  
JCSadie
 
Posts: n/a
Default

OK, I keep getting syntax errors, it sometimes points to the comma and
sometimes to the parenthesis. This is what I have

{=or({doc_param} = "AP", {doc_param} = "ap")} What else goes in here to tell
it what to do?

If I put it in an if statement then would it look something like this ? do
I set it equal to one? Shouldn't it automatically know whether it is true or
false?

{if {=or({doc_param} = "AP", {doc_param} = "ap")} = 1 "AP is True" "AP is
False"}



"Peter Jamieson" wrote:


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 a

{ =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

"JCSadie" wrote in message
...
Word 2002 ..IF statement with an OR..There was a listing in here last
week..I
should have saved it out.

{if {=or({mergefield doc_param} = "ap,*"), =or({mergefield doc_param} =
"ap&pop,*")} = 1 "Blah Blah Blah" "?????????"}

Not sure it should be = 1 for True. Did this because I was thinking of
the
AND conditional. Where do you end the parenthesis? Do you add the second
=or
after a , or a ;? Enough? That is what I meant by needing syntax!

"Graham Mayor" wrote:

Perhaps if you explained exactly what it is you are trying to do, someone
may be able assist with the correct syntax.

--

Graham Mayor - Word MVP

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




JCSadie wrote:
Need Syntax. I keep getting a syntax error.






  #7   Report Post  
Peter Jamieson
 
Posts: n/a
Default

The point is that you can't just do

{doc_param} = "AP".

Instead, you have to do

{ COMPARE { doc_param } = "AP" }

Which makes everything more unwieldy, but means that the following should
work:

{=or({ COMPARE {doc_param} = "AP" }, { COMPARE {doc_param} = "ap" })}

Then you probably need to wrap that up:

{ IF {=or({ COMPARE {doc_param} = "AP" }, { COMPARE {doc_param} = "ap" })}
= 0
"doc_param is neither AP nor ap" "doc_param is AP or ap" }

In this case the following might be what you need:

{ IF { doc_param \*Upper } = "AP" "doc_param is ap,aP,Ap or AP" "doc_param
is none of ap,aP,Ap or AP" }

Peter Jamieson

"JCSadie" wrote in message
...
OK, I keep getting syntax errors, it sometimes points to the comma and
sometimes to the parenthesis. This is what I have

{=or({doc_param} = "AP", {doc_param} = "ap")} What else goes in here to
tell
it what to do?

If I put it in an if statement then would it look something like this ?
do
I set it equal to one? Shouldn't it automatically know whether it is true
or
false?

{if {=or({doc_param} = "AP", {doc_param} = "ap")} = 1 "AP is True" "AP is
False"}



"Peter Jamieson" wrote:


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 a

{ =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

"JCSadie" wrote in message
...
Word 2002 ..IF statement with an OR..There was a listing in here last
week..I
should have saved it out.

{if {=or({mergefield doc_param} = "ap,*"), =or({mergefield doc_param} =
"ap&pop,*")} = 1 "Blah Blah Blah" "?????????"}

Not sure it should be = 1 for True. Did this because I was thinking of
the
AND conditional. Where do you end the parenthesis? Do you add the
second
=or
after a , or a ;? Enough? That is what I meant by needing syntax!

"Graham Mayor" wrote:

Perhaps if you explained exactly what it is you are trying to do,
someone
may be able assist with the correct syntax.

--

Graham Mayor - Word MVP

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




JCSadie wrote:
Need Syntax. I keep getting a syntax error.








  #8   Report Post  
JCSadie
 
Posts: n/a
Default

Thank you so much for your information. The or statements are beginning to
work. Your are greatness!

"Peter Jamieson" wrote:

The point is that you can't just do

{doc_param} = "AP".

Instead, you have to do

{ COMPARE { doc_param } = "AP" }

Which makes everything more unwieldy, but means that the following should
work:

{=or({ COMPARE {doc_param} = "AP" }, { COMPARE {doc_param} = "ap" })}

Then you probably need to wrap that up:

{ IF {=or({ COMPARE {doc_param} = "AP" }, { COMPARE {doc_param} = "ap" })}
= 0
"doc_param is neither AP nor ap" "doc_param is AP or ap" }

In this case the following might be what you need:

{ IF { doc_param \*Upper } = "AP" "doc_param is ap,aP,Ap or AP" "doc_param
is none of ap,aP,Ap or AP" }

Peter Jamieson

"JCSadie" wrote in message
...
OK, I keep getting syntax errors, it sometimes points to the comma and
sometimes to the parenthesis. This is what I have

{=or({doc_param} = "AP", {doc_param} = "ap")} What else goes in here to
tell
it what to do?

If I put it in an if statement then would it look something like this ?
do
I set it equal to one? Shouldn't it automatically know whether it is true
or
false?

{if {=or({doc_param} = "AP", {doc_param} = "ap")} = 1 "AP is True" "AP is
False"}



"Peter Jamieson" wrote:


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 a

{ =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

"JCSadie" wrote in message
...
Word 2002 ..IF statement with an OR..There was a listing in here last
week..I
should have saved it out.

{if {=or({mergefield doc_param} = "ap,*"), =or({mergefield doc_param} =
"ap&pop,*")} = 1 "Blah Blah Blah" "?????????"}

Not sure it should be = 1 for True. Did this because I was thinking of
the
AND conditional. Where do you end the parenthesis? Do you add the
second
=or
after a , or a ;? Enough? That is what I meant by needing syntax!

"Graham Mayor" wrote:

Perhaps if you explained exactly what it is you are trying to do,
someone
may be able assist with the correct syntax.

--

Graham Mayor - Word MVP

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




JCSadie wrote:
Need Syntax. I keep getting a syntax error.









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
Statement parameter in Mailmerge.OpenDataSource Christof Nordiek Mailmerge 6 April 26th 05 09:31 AM
Possible BUG: Multiple HTTPrequests send from one includetext statement Oliver Mailmerge 2 April 18th 05 09:46 AM
Multiple If... Then Statement in Word 2003 Sue Hargrave Mailmerge 1 February 26th 05 10:48 PM
How do I copy a scanned signature into an if/or statement in Word mcgowan Mailmerge 2 February 1st 05 06:37 AM
Insert carriage return in mergefield statement dixie Mailmerge 2 December 22nd 04 03:42 AM


All times are GMT +1. The time now is 11:05 AM.

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

About Us

"It's about Microsoft Word"