Use Google to find help fast. For example, search on "xpressdox choosefromlist".

Capture a multi-line address in one field

Capture a multi-line address in one field

You may not want to have to define 3 or 4 or some maximum number of address line data elements, and have the user capture them one at a time, and still provide conditional formatting logic to suppress any empty data elements.

XpressDox document assembly supports this by the concept of long text fields. The command <<CaptureAsLongText(Address,4)>> will cause XpressDox to provide a 4-line text box in the data capture interview when the template is run. The lines of the address are then typed in by the user one per line (pressing the Enter key at the end of each line).

There is a quirk (or special feature) to this, though, and that is that the <<CaptureAsLongText>> command does exactly and only what it says – it captures the data element as long text.

What it does not do is cause the data element to be inserted into the document. This is because there are three ways in which the data element can be included in the document:

  1. <<Address>> will cause the lines of the ‘Address’ to be included in one line. For example, the address captured as:
    123 Long Street
    Cape Townwould appear as:

    123 Long Street Winelands Cape Town

    in the merged document.

  2. <<InsertFormattedText(Address)>> will cause the ‘Address’ to be formatted in the merged document with each line of ‘Address’ on its own line in the merged document, just as it was entered by the user in the data capture dialog.
    With XpressDox version 4 and later, there is an extra (optional) parameter, being Paragraph or Lines. Paragraph will cause each line in ‘Address’ to appear in its own paragraph, whereas Lines (which is the default) puts line breaks between each line.
    The reason for the command being <<InsertFormattedText>> and not something like <<InsertMultiLine>> is that the text captured inside a Long Text text box need not actually contain more than one line, but can be formatted with bold, italic and underline. The help text in the data capture interview describes how to apply that formatting.
  3. <<InsertUnformattedLongText(Address,', ')>> will cause the Address data element to be inserted with the lines separated with a comma-space (the second parameter of the function). In this context the “lines” referred to are those which the user has entered using the Enter key. In other words, if the Address has more than one line just because the text has wrapped onto a new line by reason of its length, then those lines are not recognised by the InsertUnformattedLongText command.

Leave a Reply