Creating an address block

An Address Block is simply a group of different fields in your record that form an address. When sending letters, you’re probably already using pre-printed envelopes that have a plastic window showing the address that’s on the letter inside, which of course greatly simplifies mass mailing.

To create the address block so that it can be used and placed exactly where that window is, there is a simple trick which takes advantage of the way Handlebars Text Helpers work.

In order to put this article to work, you can use this data mapping configuration and create a brand new Print Template using Connect Designer.

Creating the expression

  1. First, create a new Handlebars Text Helper from the Scripts pane.
  2. Type addressblock in the Name field. This is the expression name you can use in the document (i.e. {{addressblock}}).
  3. Build the address according to the fields you have in your data. Each field needs to be on its own line, which you can add with the + on the right. Additionally, you can add extra data in the Prefix and Suffix boxes. If a field is empty, the prefix and suffix are ignored, which means you can add static text and HTML content, such as:
Prefix Field Suffix
Salution one space
FirstName one space
LastName
Line break icon Company
Line break icon Address
Line break icon City comma + one space
State &nbps;   (which adds two spaces)
ZipCode

This creates a block that would look like this:

Salution FirstName LastName
Company
Address
City, State  ZipCode

The beauty of this is simply that if the fields on a certain line are all empty, that whole line, including the Line Break in the Prefix or Suffix, will be absent, so the subsequent lines go up one position.

Adding the address block to the template

Next is to position this address block in the appropriate location of the template. This is done very easily by using a positioned box. Click on Insert > Positioned Box. On the Attributes pane and enter the following expression {{addressblock}} inside the positioned box. Adjust the box to the appropriate dimensions by using its properties.

Naturally, the positioning of the address block will depend on the envelope dimensions. Here is an example of what we commonly call a “9 envelope”.

While the address block is selected, you can move and resize it using the Attributes > Geometry pane:

  • Width: Enter the width in whichever unit you wish. For example, 4in for 4 inches.
  • Height: Same as above, for the height of the object. For example, 1in.
  • X-offset: Enter the horizontal distance from the left edge of the page. For example, 1in should be good.
  • Y-offset: Enter the vertical distance from the top edge off the page. For example, 2.35in should be good (based on the envelope dimensions above).