Mergefields, Lists, commas and "and"

P

Pete B

I have some document templates for merges. I have a large number of
data/merge fields.

In one section of the template, There is a list based on the mergefields (ie
if mergefield name coverage1=Y then "Coverage1"). I can easily list all the
selected coverages one after another using If-Then-Else.

BUT i'm having trouble for the list to correctly inter-space commas and the
word "and" between multiple coverages for correct grammer.

ie if mergefields 1, 3, 8 and 9 are not blank (Y) I want the comma / "and"
linup between words to be:

Coverage1, Coverage3, Coverage8 and Coverage9.

Using only the if-then input fields (macros won't work due to insanely high
security, i know an array would make things a LOT easier) is this possible?
Or would it include a nightmare of nested If-Thens?
 
M

macropod

Hi Pete,

First of all, you need to realise there are 2^9=512 possible outcomes that would have to be coded for. Whilst this *could* be done
in a Word mailmerge document using field coding, it would be very inefficient and your mailmerge would run like molasses down the
face of a glacier. I recommend applying some logic at the datasource to concatenate the fields and their separators into a single
new field that can be used as your mailmerge datasource.
 
D

Doug Robbins - Word MVP

Hi macropod,

I never expected to see the day when you suggested the use of something
other than fields. <G,D & R>

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

macropod said:
Hi Pete,

First of all, you need to realise there are 2^9=512 possible outcomes that
would have to be coded for. Whilst this *could* be done in a Word
mailmerge document using field coding, it would be very inefficient and
your mailmerge would run like molasses down the face of a glacier. I
recommend applying some logic at the datasource to concatenate the fields
and their separators into a single new field that can be used as your
mailmerge datasource.

--
Cheers
macropod
[MVP - Microsoft Word]


Pete B said:
I have some document templates for merges. I have a large number of
data/merge fields.

In one section of the template, There is a list based on the mergefields
(ie
if mergefield name coverage1=Y then "Coverage1"). I can easily list all
the
selected coverages one after another using If-Then-Else.

BUT i'm having trouble for the list to correctly inter-space commas and
the
word "and" between multiple coverages for correct grammer.

ie if mergefields 1, 3, 8 and 9 are not blank (Y) I want the comma /
"and"
linup between words to be:

Coverage1, Coverage3, Coverage8 and Coverage9.

Using only the if-then input fields (macros won't work due to insanely
high
security, i know an array would make things a LOT easier) is this
possible?
Or would it include a nightmare of nested If-Thens?
 
M

macropod

Hi Doug,

Well, the OP will still have to use at least one field ...

--
Cheers
macropod
[MVP - Microsoft Word]


Doug Robbins - Word MVP said:
Hi macropod,

I never expected to see the day when you suggested the use of something
other than fields. <G,D & R>

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

macropod said:
Hi Pete,

First of all, you need to realise there are 2^9=512 possible outcomes that
would have to be coded for. Whilst this *could* be done in a Word
mailmerge document using field coding, it would be very inefficient and
your mailmerge would run like molasses down the face of a glacier. I
recommend applying some logic at the datasource to concatenate the fields
and their separators into a single new field that can be used as your
mailmerge datasource.

--
Cheers
macropod
[MVP - Microsoft Word]


Pete B said:
I have some document templates for merges. I have a large number of
data/merge fields.

In one section of the template, There is a list based on the mergefields
(ie
if mergefield name coverage1=Y then "Coverage1"). I can easily list all
the
selected coverages one after another using If-Then-Else.

BUT i'm having trouble for the list to correctly inter-space commas and
the
word "and" between multiple coverages for correct grammer.

ie if mergefields 1, 3, 8 and 9 are not blank (Y) I want the comma /
"and"
linup between words to be:

Coverage1, Coverage3, Coverage8 and Coverage9.

Using only the if-then input fields (macros won't work due to insanely
high
security, i know an array would make things a LOT easier) is this
possible?
Or would it include a nightmare of nested If-Thens?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top