Combine First, Middle, and Last Names

From HotDocs Wiki

Jump to: navigation, search

Typically, when your templates require names of individuals, using separate variables for first, middle, and last names gives you the most flexibility. For example, you can more easily sort a list of names alphabetically by last name than you can if the entire name is in a single variable.

With separate variables for first, middle, and last names, you can use a Computation variable wherever you need the full name in your template. The following computations simply combine the three parts of the name, adding a space between each name and taking into consideration the fact that the middle name may not be answered.

HotDocs 2005 and earlier users:

The following computation begins with just the first name. If the middle name is answered (determined using the ANSWERED expression), a space is added to the result, followed by the middle name. Finally, another space and the last name are added to the result. Caution: The first and last name variables are required in this computation. If they are left unanswered, the computation will produce an unanswered result. Also, you should add the variables to a dialog so the middle name variable will be asked along with the first and last names. (If the middle name variable is not in a dialog, it will never be asked automatically.)

Example

First Name 
IF ANSWERED( Middle Name ) 
    RESULT + " " + Middle Name 
END IF 
RESULT + Last Name

HotDocs 2006 and later users:

This computation also starts with the first name. If the middle name is answered, it will be merged, followed by a space character. If not, the SPACE instruction merges nothing.

Example

First Name + " " + SPACE( Middle Name ) + Last Name

First Name A Text variable for an individual's first name.
Middle Name A Text variable for an individual's middle name.
Last Name A Text variable for an individual's last name.