F
FUBARinSFO
Hi:
N00b to Word mail merge here -- apologies in advance.
I'm looking for a conditional line print function -- print/not print
the line as the result of evaluating some expression.
All the solutions I've seen here and elsewhere seem to involve the
chaining of mergefield using the IF statement
(http://www.gmayor.com/formatting_word_fields.htm - "Insert field
information and associated text conditionally") or the code for example
from Graham Major in his posting "Mail Merge and Printing Empty
Fields", shown below:
.....................................................................
Mergefield FirstName} {Mergefield Lastname}
{Mergefield Company}
{Mergefield Address1}
etc
and when Company is empty you get an unwanted blank line. You can then
manually insert your conditional entry on the previous line:
{Mergefield FirstName} {Mergefield Lastname}{IF{Mergefield Company} <>
"" "
{Mergefield Company}"}
{Mergefield Address1}
etc
Press 'enter' after the first " that defines the start of the
conditional
result. Thus if Mergefield Company is not empty (<> "") then the result
places the line feed *and* the Company field. If the mergefield *is*
empty
it does nothing.
..............................................................................
The bug in this chained code is that if the first field is null, but
the second is not, it will print a blank line first and then the second
line field. Aside from that, it is incredibly unreadable to try to
construct a multi-line output using a chained construction like this.
But more generally, what is really needed here is a simple
variable/field that evaluates an expression and either or prints or
suppresses the print of the line that it is on. Isn't that possible?
This chained code is not only wrong, but an incredible hack.
FWIW, I've been using MicroPro InfoStar since around 1983. Its report
writer has the ability to print/not print a line depending on the
evaluation of an expression composed of data record fields. I'm
assuming that Crystal Reports and other database-associated report
writers have this capability. MicroPro's WordStar has it (per my
recollection) -- doesn't Microsoft Word 2003?
TIA
-- Roy Zider
N00b to Word mail merge here -- apologies in advance.
I'm looking for a conditional line print function -- print/not print
the line as the result of evaluating some expression.
All the solutions I've seen here and elsewhere seem to involve the
chaining of mergefield using the IF statement
(http://www.gmayor.com/formatting_word_fields.htm - "Insert field
information and associated text conditionally") or the code for example
from Graham Major in his posting "Mail Merge and Printing Empty
Fields", shown below:
.....................................................................
Mergefield FirstName} {Mergefield Lastname}
{Mergefield Company}
{Mergefield Address1}
etc
and when Company is empty you get an unwanted blank line. You can then
manually insert your conditional entry on the previous line:
{Mergefield FirstName} {Mergefield Lastname}{IF{Mergefield Company} <>
"" "
{Mergefield Company}"}
{Mergefield Address1}
etc
Press 'enter' after the first " that defines the start of the
conditional
result. Thus if Mergefield Company is not empty (<> "") then the result
places the line feed *and* the Company field. If the mergefield *is*
empty
it does nothing.
..............................................................................
The bug in this chained code is that if the first field is null, but
the second is not, it will print a blank line first and then the second
line field. Aside from that, it is incredibly unreadable to try to
construct a multi-line output using a chained construction like this.
But more generally, what is really needed here is a simple
variable/field that evaluates an expression and either or prints or
suppresses the print of the line that it is on. Isn't that possible?
This chained code is not only wrong, but an incredible hack.
FWIW, I've been using MicroPro InfoStar since around 1983. Its report
writer has the ability to print/not print a line depending on the
evaluation of an expression composed of data record fields. I'm
assuming that Crystal Reports and other database-associated report
writers have this capability. MicroPro's WordStar has it (per my
recollection) -- doesn't Microsoft Word 2003?
TIA
-- Roy Zider