constructmailinglabel
constructmailinglabel
TEMPLATE

The constructmailinglabel statement creates the form elements for printing mailing labels.

Parameters

This statement has one parameter:

template – text and tags that specify options for constructing a mailing label (see discussion below).

Description

This statement automatically creates the form elements for printing mailing labels. The template parameter allows you to customize how labels are formatted. You can specify which fields are included, the label size, font, etc. These tags are discussed below.

Keep in mind that this statement generates regular form objects, just as if you had created them manually. Once the objects are generated, you can manipulate these objects in Graphics Mode any way you like.

#### Fields & Punctuation

To include a field on the label, type in the name of the field surrounded by « and » characters (Option-\ and Shift-Option-\). Here’s an example of a typical mailing label with 5 fields:

    constructmailinglabel
    "«Name»
    «Address»
    «City», «State» «Zip»"

As you can see, this example also includes punctuation: spaces, carriage returns, and a comma. You can type in any extra text you want. In this example, `Attn:` will be printed in front of the name.

    constructmailinglabel
    "Attn: «First» «Last»
    «Address»
    «City», «State» «Zip»"

Note: Any spaces or line breaks before or after the text will be ignored.

If a line is completely blank, it will collapse when printed. For example, for records where the Suite field is blank, the City, State Zip line will move up just below the Address line.

    constructmailinglabel
    "Attn: «First» «Last»
    «Address»
    «Suite»
    «City», «State» «Zip»"

This will only happen if the field is on a line all by itself. If that is not the case, you would need to use a formula (see below) to ensure that the line “collapses” when needed.

#### Formulas

In addition to single fields, you can embed an entire formula into the label by enclosing it with `{` and `}` characters. This example uses formulas so that only the first initial of the name will be printed, and so that the City will be printed in all upper case letters.

    constructmailinglabel
    "Attn: {First[1,1]} «Last»
    «Address»
    {upper(City)}, «State» «Zip»"

#### Tags

To customize the generated form objects you can include one or more tags. Like HTML tags, these tags start and end with `<` and `>` characters.

#### Avery Labels

The most common mailing labels are from Avery. Using the `<avery:type>` tag, you can easily specify the most common Avery labels:

    constructmailinglabel
    "<avery:5163>
    «Name»
    «Address»
    «City», «State» «Zip»"

There are five Avery labels supported, 5160–5164. If you don’t specify any label or label dimensions, the default is Avery 5160.

#### Custom Label Dimensions

If you’re using something other than an Avery label, you can specify custom label dimension with the `<height:distance>`, `<width:distance>`, `<topmargin:distance>` and `<leftmargin:distance>` tags. The measurements are normally expressed in points (1 point = 1/72 inch) but you can also specify values in inches (`1 in` or `2.5 inch` or `0.75"`) or centimeters (`20 cm`).

    constructmailinglabel
    |||<height:2"><width:4"><topmargin:0.5"><leftmargin:0.25">
    «Name»
    «Address»
    «City», «State» «Zip»|||

Note the use of `|||` for quoting, so that the quote symbol itself can be included in the tags.

#### Label Columns and Direction

Many labels have multiple columns on a page, for example Avery 5160 labels are 3-up. Panorama normally calculates the number of columns from the label width, but you can also explicitly specify from one to four columns with the `<labelcolumns:count>` tag. You can also specify whether labels are printed across or down with the `<direction:across/down>` tag.

#### Text Inset

The text is normally inset on the label by 8 points (1/12th inch). Use the `<inset:distance>` tag to specify a different inset.

#### Text Size

The size (height) of the text is normally calculated automatically so that the text vertically fills the label, but you can override this.

Use the `<lines:count>` tag to specify the number of lines in the text (normally this is counted for you). In this example, the automatic line count would be 3, but what if the Address field contains 2 lines? By manually setting the lines to 4, the text height is reduced to leave height for the extra address line.

    constructmailinglabel
    "<lines:4>
    «Name»
    «Address»
    «City», «State» «Zip»"

You can also explicitly set the text height with the `<labelfontsize:height>` tag. When this tag is used, the number of lines is ignored.

    constructmailinglabel
    "<avery:5164><labelfontsize:18>
    «Name»
    «Address»
    «City», «State» «Zip»"

#### Text Font

Labels text is normally Helvetica. Use the `<labelfont:name>` tag for a different font.

    constructmailinglabel
    "<labelfont:Papyrus>
    «Name»
    «Address»
    «City», «State» «Zip»"

#### Rich Text

You can embed RTML tags (see richtextdisplay() into the text to make a word or phrase bold, italic, a different font or color, etc. This example will print the person’s name in bold.

    constructmailinglabel
    "Attn: <b>«First» «Last»</b>
    «Address»
    «City», «State» «Zip»"

Note: If you use rich text tags, empty lines won’t collapse automatically. Instead, you’ll have to use a formula to get them to collapse.

#### Removing Existing Form Objects

If the very first item in the template is the `<zapform>` tag, the form will be cleared before generating the new objects. Be careful with this tag – it will destroy everything in the form before adding the new objects!

Note: Even if you don’t include the `<zapform>` tag, this statement will clear any objects that were previously generated by this statement. In other words, even if you use this statement multiple times you’ll only end up with one set of generated objects.

See Also

- constructformdataeditors -- creates a column of form elements for editing data fields (or variables).
- constructlineitems -- creates a grid of line items.
- constructlistmatrix -- creates a text list or matrix in the current form.
- constructreport -- creates a report in the current form.
- constructtabpanel -- creates a tab panel in the current form.
- formconstructordialog -- opens a generic form constructor dialog.
- newsearchgadget -- creates a search gadget in the current form.

History

Version | Status | Notes
10.0 | New | New in this version.