Merge Logic Functions

J

joe925c

Word 2007 Windows XP Home.

Recipient List
Merged Output Desired
First Name M First Name F Surname
Jim Fir
Jim Fir
Joan Beech
Joan Beech
Pine
Pine
Paul Dianne Oak
Paul and Dianne Oak

Basically want IF {First Name M} AND {First Name F} ARE not blank then PRINT
{{First Name M} and {First Name F}} ELSE PRINT {First Name M}{ First Name F}

Have tried to work with the IF..THEN..ELSE "rule" including nesting IFs but
no luck. Any solutions?
 
M

macropod

Hi joe925c,

You could code your field as:
{IF{IF{MERGEFIELD First_Name_M}<> "" 1 0}+{IF{MERGEFIELD First_Name_F}<> "" 1 0}= 2 "{MERGEFIELD First_Name_M} and {MERGEFIELD
First_Name_F} "{MERGEFIELD First_Name_M}{MERGEFIELD First_Name_M}"}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message.
 
J

joe925c

macropod,

Thanks for your response. Where can I find all the logic functions
available? I used help and spent some time online at the Microsoft help
series and even have the "Microsoft Office 2007 Bible" and no mention of the
logic functions that I could find.

I gather that you put the DO and ElSE data in quotes. I had thought that you
only did that if the data was pure text. Makes sense or would be unable to
determine the two strings. In this regard, below is the last series of data
from your suggested solution.

First_Name_F} "{MERGEFIELD First_Name_M}{MERGEFIELD First_Name_M}"}

Is there a missing quote mark after the First_Name_F}? That point would be
the end of the DO string.

macropod said:
Hi joe925c,

You could code your field as:
{IF{IF{MERGEFIELD First_Name_M}<> "" 1 0}+{IF{MERGEFIELD First_Name_F}<> "" 1 0}= 2 "{MERGEFIELD First_Name_M} and {MERGEFIELD
First_Name_F} "{MERGEFIELD First_Name_M}{MERGEFIELD First_Name_M}"}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message.

--
Cheers
macropod
[MVP - Microsoft Word]


joe925c said:
Word 2007 Windows XP Home.

Recipient List
Merged Output Desired
First Name M First Name F Surname
Jim Fir
Jim Fir
Joan Beech
Joan Beech
Pine
Pine
Paul Dianne Oak
Paul and Dianne Oak

Basically want IF {First Name M} AND {First Name F} ARE not blank then PRINT
{{First Name M} and {First Name F}} ELSE PRINT {First Name M}{ First Name F}

Have tried to work with the IF..THEN..ELSE "rule" including nesting IFs but
no luck. Any solutions?
 
M

macropod

Hi joe925c,

It seems a doub;e-quote got lost somewhere along the line. The coding should have been:
{IF{IF{MERGEFIELD First_Name_M}<> "" 1 0}+{IF{MERGEFIELD First_Name_F}<> "" 1 0}= 2 "{MERGEFIELD First_Name_M} and {MERGEFIELD
First_Name_F}" "{MERGEFIELD First_Name_M}{MERGEFIELD First_Name_M}"}

Alternatively, one could use:
{MERGEFIELD First_Name_M}{IF{IF{MERGEFIELD First_Name_M}<> "" 1 0}+{IF{MERGEFIELD First_Name_F}<> "" 1 0}= 2 " and " ""}{MERGEFIELD
First_Name_M}

The logic in the IF test is something I developed myself. I can't recall anything from MS discussing anything similar. You'll see
the above technique and a variety of other field manipulations demonstrated in my Word Field Maths 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=365442
or
http://www.gmayor.com/downloads.htm#Third_party

--
Cheers
macropod
[MVP - Microsoft Word]


joe925c said:
macropod,

Thanks for your response. Where can I find all the logic functions
available? I used help and spent some time online at the Microsoft help
series and even have the "Microsoft Office 2007 Bible" and no mention of the
logic functions that I could find.

I gather that you put the DO and ElSE data in quotes. I had thought that you
only did that if the data was pure text. Makes sense or would be unable to
determine the two strings. In this regard, below is the last series of data
from your suggested solution.

First_Name_F} "{MERGEFIELD First_Name_M}{MERGEFIELD First_Name_M}"}

Is there a missing quote mark after the First_Name_F}? That point would be
the end of the DO string.

macropod said:
Hi joe925c,

You could code your field as:
{IF{IF{MERGEFIELD First_Name_M}<> "" 1 0}+{IF{MERGEFIELD First_Name_F}<> "" 1 0}= 2 "{MERGEFIELD First_Name_M} and {MERGEFIELD
First_Name_F} "{MERGEFIELD First_Name_M}{MERGEFIELD First_Name_M}"}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message.

--
Cheers
macropod
[MVP - Microsoft Word]


joe925c said:
Word 2007 Windows XP Home.

Recipient List
Merged Output Desired
First Name M First Name F Surname
Jim Fir
Jim Fir
Joan Beech
Joan Beech
Pine
Pine
Paul Dianne Oak
Paul and Dianne Oak

Basically want IF {First Name M} AND {First Name F} ARE not blank then PRINT
{{First Name M} and {First Name F}} ELSE PRINT {First Name M}{ First Name F}

Have tried to work with the IF..THEN..ELSE "rule" including nesting IFs but
no luck. Any solutions?
 

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