Documentation/How Tos/Suppressing Blank Address2 Fields in Mail Merge Documents

From Wiki
Revision as of 07:20, 30 March 2012 by Sancho (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Checked.png Checked for technical accuracy mwaller july08

Here is the situation we are addressing. Sometimes your addresses have two lines for the address part, sometimes they do not.

Bob Jones Marion Silverman
101 Main 888 105th Ave
Suite 55 Broomfield, CO 82211
Boulder, CO 80022


But you have to put in the <Address2> field for everybody, since it is a mail merge. The setup has to be the same.

<Firstname> <Lastname>
<Address1>
<Address2>
<City>, <State>, <Zip>


But with this approach, your addresses look like this.

Bob Jones Marion Silverman
101 Main 888 105th Ave
Suite 55
Boulder, CO 80022 Broomfield, CO 82211


How do you suppress that second Address2 line and the corresponding carriage return if there is no content for a particular record, for that Addres2 field?

Here is the guide, using an example of labels.

  1. Create the labels for mail merge as usual. File > New > Labels, select your database and tables, insert the fields, etc.(See Creating Mail Merge Documents From Text/CSV or Spreadsheets)
  2. Choose the Synchronize Contents checkbox.
  3. Click New Document. The labels will appear.
  4. Turn on nonprinting characters if they are not on already, by choosing View > Nonprinting Characters.
  5. Select the first soft return, shown selected.
    File:Doc Howto label softreturn.png
    Label with soft returns
  6. Press Return or Enter to replace it with a hard return.
  7. Repeat, to make them all hard returns.
  8. Click Synchronize Labels to update the other labels to be the same.
  9. Select the Address2 field.
  10. Choose Insert > Section.
  11. Name the new section Suppress. Select the Hide checkbox and type the following condition.
  12. databasename.tablename.fieldname EQ "" The names are case sensitive and the last part is two double quotes together. Example: databasename = DatabaseWithTwoAddresslines tablename = Table1 fieldname = Address2
    Documentation note.png If you are using the Thunderbird address book as a data source, you need to use square brackets if the field name includes a space (i. e.:[Address 2]=="" ) to hide the second line of the address if the Address 2 field is blank. In general, avoid field, table, or database names with spaces.
  13. Click Insert.
  14. Click Synchronize Labels.
  15. Now preview the data or print the data.

If you need to change the section, select it in the first address and choose Format > Section. Select the one named Suppress for the master label and make changes, then click OK. Click Synchronize labels again.

Tip.png Here is another way to suppress blank Address2 fields: After having replaced the soft returns by hard returns click at the end of the Address2 paragraph. Then choose Insert > Fields > Other, select the Functions tab and click on Hidden Paragraph in the Type column. In the Condition box enter the condition that defines a blank address field.

The condition has the general form of:

 [databasename.tablename.fieldname] EQ ""

If you have the data table in view (F4), you don't have to type the database field. You can enter it simply by selecting the field (column) in the table view and dragging it into the condition box.

Now click Insert and Close buttons, and Synchronize Labels as before.



This How To comes from Solveig Haugland's Blog

Content on this page is licensed under the Public Documentation License (PDL).

nl:NL/Documentation/How_Tos/Suppressing_Blank_Address2_Fields_in_Mail_Merge_Documents