#1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Chris Stammers Chris Stammers is offline
external usenet poster
 
Posts: 46
Default Next If

Hello,

I am trying to set up a document and I need it to ignore a record with a
given criteria. I have used 'Skip If' before however this statement generates
lots of error messages within our document generation system and I am trying
to avoid that. How does 'Next If' differ from 'Skip If' and can I use more
than one 'Next If' statement in a document? I have set the document up with
the following:

«Next If {FIELD1} 2» «Next If {FIELD2} 1» «Next If {FIELD1} B»

Do you foresee any problems with that? I am using Windows XP and Word 2000
from Office 2000 Premium

Thanks,
Chris
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Next If

Next if has some similar constraints to Skip if, e.g. you can't use
it in certain places such as text boxes.

However, the effect of next if is quite literal, i.e. if the condition
is true, Word will move to the next data source record and continue
processing the current "copy" of the Mail Merge Main Document. If the
condition is false, Word takes no action. So...

«Next If {FIELD1} 2» «Next If {FIELD2} 1» «Next If {FIELD1} B»


....if you're trying to use that to move 3 records if field1 is "C" and
field2 is 50, that should work. But if you're trying to move 1 record if
(field1 is not 2) or (field2 is not 1) or (field1 is not B) then you need to
put all the conditions inside a single Next if, which you could do using
e.g.

{ NEXTIF { ={ COMPARE { MERGEFIELD FIELD1 } 2 }+{ COMPARE { MERGEFIELD
FIELD2 } 1 }+{ COMPARE { MERGEFIELD FIELD1 } "B" } } 0 }

(Or something like that...)

Peter Jamieson
"Chris Stammers" wrote in message
...
Hello,

I am trying to set up a document and I need it to ignore a record with a
given criteria. I have used 'Skip If' before however this statement
generates
lots of error messages within our document generation system and I am
trying
to avoid that. How does 'Next If' differ from 'Skip If' and can I use more
than one 'Next If' statement in a document? I have set the document up
with
the following:

«Next If {FIELD1} 2» «Next If {FIELD2} 1» «Next If {FIELD1} B»

Do you foresee any problems with that? I am using Windows XP and Word 2000
from Office 2000 Premium

Thanks,
Chris


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Chris Stammers Chris Stammers is offline
external usenet poster
 
Posts: 46
Default Next If

Thanks Peter. Apologies if I sound thick here - do I need to manually
construct that statement? It's just that it is my understanding that it won't
work if you do and the Next If statement doesn't have the facility to expand
or add in the way. Or am I totally missing the point?

Thanks.
Regards,
Chris

"Peter Jamieson" wrote:

Next if has some similar constraints to Skip if, e.g. you can't use
it in certain places such as text boxes.

However, the effect of next if is quite literal, i.e. if the condition
is true, Word will move to the next data source record and continue
processing the current "copy" of the Mail Merge Main Document. If the
condition is false, Word takes no action. So...

«Next If {FIELD1} 2» «Next If {FIELD2} 1» «Next If {FIELD1} B»


...if you're trying to use that to move 3 records if field1 is "C" and
field2 is 50, that should work. But if you're trying to move 1 record if
(field1 is not 2) or (field2 is not 1) or (field1 is not B) then you need to
put all the conditions inside a single Next if, which you could do using
e.g.

{ NEXTIF { ={ COMPARE { MERGEFIELD FIELD1 } 2 }+{ COMPARE { MERGEFIELD
FIELD2 } 1 }+{ COMPARE { MERGEFIELD FIELD1 } "B" } } 0 }

(Or something like that...)

Peter Jamieson
"Chris Stammers" wrote in message
...
Hello,

I am trying to set up a document and I need it to ignore a record with a
given criteria. I have used 'Skip If' before however this statement
generates
lots of error messages within our document generation system and I am
trying
to avoid that. How does 'Next If' differ from 'Skip If' and can I use more
than one 'Next If' statement in a document? I have set the document up
with
the following:

«Next If {FIELD1} 2» «Next If {FIELD2} 1» «Next If {FIELD1} B»

Do you foresee any problems with that? I am using Windows XP and Word 2000
from Office 2000 Premium

Thanks,
Chris


  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Next If

do I need to manually
construct that statement?


Yes, you basically start with ctrl-F9 to insert each pair of the special
field braces {} and type everything else. You could do it in VBA also.

It's just that it is my understanding that it won't
work if you do


Not sure what you mean here - are you saying that { NEXTIF } fields will
only work if you construct them using the Next If dropdown entry?

and the Next If statement doesn't have the facility to expand
or add in the way.


...or here!

Peter Jamieson

"Chris Stammers" wrote in message
...
Thanks Peter. Apologies if I sound thick here - do I need to manually
construct that statement? It's just that it is my understanding that it
won't
work if you do and the Next If statement doesn't have the facility to
expand
or add in the way. Or am I totally missing the point?

Thanks.
Regards,
Chris

"Peter Jamieson" wrote:

Next if has some similar constraints to Skip if, e.g. you can't
use
it in certain places such as text boxes.

However, the effect of next if is quite literal, i.e. if the
condition
is true, Word will move to the next data source record and continue
processing the current "copy" of the Mail Merge Main Document. If the
condition is false, Word takes no action. So...

«Next If {FIELD1} 2» «Next If {FIELD2} 1» «Next If {FIELD1} B»


...if you're trying to use that to move 3 records if field1 is "C" and
field2 is 50, that should work. But if you're trying to move 1 record if
(field1 is not 2) or (field2 is not 1) or (field1 is not B) then you need
to
put all the conditions inside a single Next if, which you could do
using
e.g.

{ NEXTIF { ={ COMPARE { MERGEFIELD FIELD1 } 2 }+{ COMPARE { MERGEFIELD
FIELD2 } 1 }+{ COMPARE { MERGEFIELD FIELD1 } "B" } } 0 }

(Or something like that...)

Peter Jamieson
"Chris Stammers" wrote in
message
...
Hello,

I am trying to set up a document and I need it to ignore a record with
a
given criteria. I have used 'Skip If' before however this statement
generates
lots of error messages within our document generation system and I am
trying
to avoid that. How does 'Next If' differ from 'Skip If' and can I use
more
than one 'Next If' statement in a document? I have set the document up
with
the following:

«Next If {FIELD1} 2» «Next If {FIELD2} 1» «Next If {FIELD1} B»

Do you foresee any problems with that? I am using Windows XP and Word
2000
from Office 2000 Premium

Thanks,
Chris




  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Chris Stammers Chris Stammers is offline
external usenet poster
 
Posts: 46
Default Next If

Got it! Thanks. I'll see how I get on with that.

Regards,
Chris

"Peter Jamieson" wrote:

do I need to manually
construct that statement?


Yes, you basically start with ctrl-F9 to insert each pair of the special
field braces {} and type everything else. You could do it in VBA also.

It's just that it is my understanding that it won't
work if you do


Not sure what you mean here - are you saying that { NEXTIF } fields will
only work if you construct them using the Next If dropdown entry?

and the Next If statement doesn't have the facility to expand
or add in the way.


...or here!

Peter Jamieson

"Chris Stammers" wrote in message
...
Thanks Peter. Apologies if I sound thick here - do I need to manually
construct that statement? It's just that it is my understanding that it
won't
work if you do and the Next If statement doesn't have the facility to
expand
or add in the way. Or am I totally missing the point?

Thanks.
Regards,
Chris

"Peter Jamieson" wrote:

Next if has some similar constraints to Skip if, e.g. you can't
use
it in certain places such as text boxes.

However, the effect of next if is quite literal, i.e. if the
condition
is true, Word will move to the next data source record and continue
processing the current "copy" of the Mail Merge Main Document. If the
condition is false, Word takes no action. So...

«Next If {FIELD1} 2» «Next If {FIELD2} 1» «Next If {FIELD1} B»

...if you're trying to use that to move 3 records if field1 is "C" and
field2 is 50, that should work. But if you're trying to move 1 record if
(field1 is not 2) or (field2 is not 1) or (field1 is not B) then you need
to
put all the conditions inside a single Next if, which you could do
using
e.g.

{ NEXTIF { ={ COMPARE { MERGEFIELD FIELD1 } 2 }+{ COMPARE { MERGEFIELD
FIELD2 } 1 }+{ COMPARE { MERGEFIELD FIELD1 } "B" } } 0 }

(Or something like that...)

Peter Jamieson
"Chris Stammers" wrote in
message
...
Hello,

I am trying to set up a document and I need it to ignore a record with
a
given criteria. I have used 'Skip If' before however this statement
generates
lots of error messages within our document generation system and I am
trying
to avoid that. How does 'Next If' differ from 'Skip If' and can I use
more
than one 'Next If' statement in a document? I have set the document up
with
the following:

«Next If {FIELD1} 2» «Next If {FIELD2} 1» «Next If {FIELD1} B»

Do you foresee any problems with that? I am using Windows XP and Word
2000
from Office 2000 Premium

Thanks,
Chris






  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Chris Stammers Chris Stammers is offline
external usenet poster
 
Posts: 46
Default Next If

One more question - will the NEXTIF function select the next record even if
it doesn't meet the criteria? The reason I ask is that when I constructed the
string, the document produced however there were records included that
shouldn't have been. Also, what is the function of the 0 inside the last
bracket?

Thanks,
Chris

"Peter Jamieson" wrote:

do I need to manually
construct that statement?


Yes, you basically start with ctrl-F9 to insert each pair of the special
field braces {} and type everything else. You could do it in VBA also.

It's just that it is my understanding that it won't
work if you do


Not sure what you mean here - are you saying that { NEXTIF } fields will
only work if you construct them using the Next If dropdown entry?

and the Next If statement doesn't have the facility to expand
or add in the way.


...or here!

Peter Jamieson

"Chris Stammers" wrote in message
...
Thanks Peter. Apologies if I sound thick here - do I need to manually
construct that statement? It's just that it is my understanding that it
won't
work if you do and the Next If statement doesn't have the facility to
expand
or add in the way. Or am I totally missing the point?

Thanks.
Regards,
Chris

"Peter Jamieson" wrote:

Next if has some similar constraints to Skip if, e.g. you can't
use
it in certain places such as text boxes.

However, the effect of next if is quite literal, i.e. if the
condition
is true, Word will move to the next data source record and continue
processing the current "copy" of the Mail Merge Main Document. If the
condition is false, Word takes no action. So...

«Next If {FIELD1} 2» «Next If {FIELD2} 1» «Next If {FIELD1} B»

...if you're trying to use that to move 3 records if field1 is "C" and
field2 is 50, that should work. But if you're trying to move 1 record if
(field1 is not 2) or (field2 is not 1) or (field1 is not B) then you need
to
put all the conditions inside a single Next if, which you could do
using
e.g.

{ NEXTIF { ={ COMPARE { MERGEFIELD FIELD1 } 2 }+{ COMPARE { MERGEFIELD
FIELD2 } 1 }+{ COMPARE { MERGEFIELD FIELD1 } "B" } } 0 }

(Or something like that...)

Peter Jamieson
"Chris Stammers" wrote in
message
...
Hello,

I am trying to set up a document and I need it to ignore a record with
a
given criteria. I have used 'Skip If' before however this statement
generates
lots of error messages within our document generation system and I am
trying
to avoid that. How does 'Next If' differ from 'Skip If' and can I use
more
than one 'Next If' statement in a document? I have set the document up
with
the following:

«Next If {FIELD1} 2» «Next If {FIELD2} 1» «Next If {FIELD1} B»

Do you foresee any problems with that? I am using Windows XP and Word
2000
from Office 2000 Premium

Thanks,
Chris




  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Next If

One more question - will the NEXTIF function select the next record even
if
it doesn't meet the criteria?


Yes. All NEXTIF does is tell Word to move to the next record if the criteria
match. Word then processes the remainder of the Mail Merge Main Document
starting from that document.

This is wht I meant when I said that "the effect of next if is quite
literal". It doesn't provide a mechanism to filter all records that match
the criteria until you get to the next one that does not. In theory, SKIP IF
kind of does that, but also has its limitations. In short, there is at least
one field missing from the language and it's probably something like { NEXT
WHILE }

Typically to exclude all records that meet certain criteria, you need to do
it in the data source and/or the query that drives the merge. But that's
actually logically different from what a { NEXT WHILE } would give you.

Also, what is the function of the 0 inside the last
bracket?


COMPARE returns 0 if the comparison fails and 1 if the comparison succeeds.

So the { =compare+compare+compare } field returns 0 only if all the
comparisons fail. If one or more succeed you get a number between 1 and 3.

So if you want to NEXTIF only if one or more comparisons succeed, you want
{ =compare+compare+compare } to be non-zero (or 0, if you want).

Peter Jamieson
"Chris Stammers" wrote in message
...
One more question - will the NEXTIF function select the next record even
if
it doesn't meet the criteria? The reason I ask is that when I constructed
the
string, the document produced however there were records included that
shouldn't have been. Also, what is the function of the 0 inside the
last
bracket?

Thanks,
Chris

"Peter Jamieson" wrote:

do I need to manually
construct that statement?


Yes, you basically start with ctrl-F9 to insert each pair of the special
field braces {} and type everything else. You could do it in VBA also.

It's just that it is my understanding that it won't
work if you do


Not sure what you mean here - are you saying that { NEXTIF } fields will
only work if you construct them using the Next If dropdown entry?

and the Next If statement doesn't have the facility to expand
or add in the way.


...or here!

Peter Jamieson

"Chris Stammers" wrote in
message
...
Thanks Peter. Apologies if I sound thick here - do I need to manually
construct that statement? It's just that it is my understanding that it
won't
work if you do and the Next If statement doesn't have the facility to
expand
or add in the way. Or am I totally missing the point?

Thanks.
Regards,
Chris

"Peter Jamieson" wrote:

Next if has some similar constraints to Skip if, e.g. you
can't
use
it in certain places such as text boxes.

However, the effect of next if is quite literal, i.e. if the
condition
is true, Word will move to the next data source record and continue
processing the current "copy" of the Mail Merge Main Document. If the
condition is false, Word takes no action. So...

«Next If {FIELD1} 2» «Next If {FIELD2} 1» «Next If {FIELD1}
B»

...if you're trying to use that to move 3 records if field1 is "C" and
field2 is 50, that should work. But if you're trying to move 1 record
if
(field1 is not 2) or (field2 is not 1) or (field1 is not B) then you
need
to
put all the conditions inside a single Next if, which you could do
using
e.g.

{ NEXTIF { ={ COMPARE { MERGEFIELD FIELD1 } 2 }+{ COMPARE {
MERGEFIELD
FIELD2 } 1 }+{ COMPARE { MERGEFIELD FIELD1 } "B" } } 0 }

(Or something like that...)

Peter Jamieson
"Chris Stammers" wrote in
message
...
Hello,

I am trying to set up a document and I need it to ignore a record
with
a
given criteria. I have used 'Skip If' before however this statement
generates
lots of error messages within our document generation system and I
am
trying
to avoid that. How does 'Next If' differ from 'Skip If' and can I
use
more
than one 'Next If' statement in a document? I have set the document
up
with
the following:

«Next If {FIELD1} 2» «Next If {FIELD2} 1» «Next If {FIELD1}
B»

Do you foresee any problems with that? I am using Windows XP and
Word
2000
from Office 2000 Premium

Thanks,
Chris





Reply
Thread Tools
Display Modes

Posting Rules

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

Forum Jump


All times are GMT +1. The time now is 10:54 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"