Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
FUBARinSFO FUBARinSFO is offline
external usenet poster
 
Posts: 6
Default Is there no conditional line print function or variable?

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

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Is there no conditional line print function or variable?

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.


I think you have probably misunderstood what Graham's code is trying to
show. As far as I'm aware it is just trying to show that you can avoid a
blank line for /one/ field by using the construction he suggests. This
particular example isn't trying to show how you can avoid blank lines for
/every/ line where fields are blank.

Aside from that, it is incredibly unreadable to try to
construct a multi-line output using a chained construction like this.


It would of course be nice if we could avoid this kind of construction, but
even the construct which the authors of Word (and the people in this group
do not work for Microsoft and did not write Word) introduced specifically
for Addresses (the ADDRESSBLOCK field ) does not work as well as it might.
So all anyone can do is offer workarounds, and they are (almost) inevitably
less pretty than something which gets the thing right in the first place.
For example, one workaround is to construct the complete address in the data
source, but that's even less likely to be possible for many users, even if
the data source supports it.

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?


I expect so, but there is no such facility in the current version of Word.
It may be worth e-mailing but I suspect even then
you'll be waiting until the version after Word 2007. A few years ago I
submitted a number of suggestions for improving mailmerge and the "field
language" in general, but Microsoft is obviously driven by commercial
consierations that have led it to invest most of its effort elsewhere
(primarily in XML technology, which I expect is where they'll probably be
looking for any kind of successor to the current "field language").

Some things that you may or may not have picked up so far (I'm not saying
they fix the problem, or even help with the specific problem of suppressing
blank lines, but they are potentially relevant when trying to do stuff in
this general area):
a. Word's default behaviour is already to suppress blank lines that result
from one or more blank MERGEFIELD fields. However in some recent versions of
Word, that doesn't work inside nested fields (e.g. IF or INCLUDETEXT
fields), and there are other complications
b. In Word 2003 the MERGEFIELD field has \b and \f switches that allow text
(and other fields) to be inserted before and after a non-blank. (Not
available for use in other types of field).
c. It is possible to modify the list of fields and the text that Word
inserts in its ADDRESSBLOCK. However,
- it is clearly not Microsoft's intention that users should do this
- the "field" names used by ADDRESSBLOCK are undocumented
- if you ever use the ADDRESSBLOCK edit dialog, any manual changes are
lost

MicroPro's WordStar has it (per my recollection)


:-) Can't remember myself (we used WordStar from back in the CP/M days until
about version 5.5 or 6, and pushed it to the limits in some areas). But I
wouldn't personally say that WordStar's dot commands and merge variable
syntax was readable or particularly easy to use either.

Peter Jamieson



"FUBARinSFO" wrote in message
ps.com...
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



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
FUBARinSFO FUBARinSFO is offline
external usenet poster
 
Posts: 6
Default Is there no conditional line print function or variable?


Peter:

Thank you so much for your extended and comprehensive reply. That was
exactly what I was looking for -- not only a confirmation of the
workaround for suppressing the printing of blank lines, but some
perspective on Word's Mail Merge functionality in general.

I did subsequently discover the \f switch for MERGFIELD, which has the
intended effect (for what appears to be single-variable lines with no
other text on them).

I just checked Wordstar, and my recollection was correct: .if, .ei, .el
commands allow for conditional print -- very simple and
straightforward. Word in comparison, in so many ways, is such a hack.
It probably needs a complete rewrite.

Thank you again for your thoughtful reply.

-- Roy Zider

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
First line of letter appears in bold print Joanie New Users 1 September 15th 06 08:03 AM
Widowed line in a table chadwilliams Tables 7 August 26th 06 09:56 PM
The bottom line of a box won't print no matter what I do! [email protected] Microsoft Word Help 20 August 8th 06 01:16 AM
Print preview shoud reflect all chosen print options Cooz Microsoft Word Help 1 March 10th 06 04:19 PM
Turning on the Print Screen Function StarRider Microsoft Word Help 1 June 2nd 05 08:16 PM


All times are GMT +1. The time now is 03:56 PM.

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"