HotDocs Author WorkflowCreate a template Add placeholders Group variables in dialogs Upload a template Create a script

SPACE Function

This SPACE function returns the value of an answered variable, including an appended space character. To this, the function tests whether the variable is answered. If it is, it merges the answer, followed by a space character. If the variable is unanswered, it merges nothing (""). If append:TEXT is left empty, the default is [space]. Otherwise, replace append:TEXT with a character or text string that can be used in place of the space character. You can use the following characters in your function:

Character Description
\\ backslash character
\h non-breaking hyphen
\l line break
\p paragraph mark
\s non-breaking space
\t tab

 

Function name SPACE
Usage model SPACE ( t:TEXT, append:TEXT )
Parameters This function requires you to replace one or two parameters:

t: TEXT

The function determines wether or not this variable is answered.

append: TEXT

The function uses the value of this variable to determine what it enters after the t: TEXT value.
Result A text value.

Example

For example, assume you need to merge a client's full name. Some clients, however, do not have a middle name. You can create a script that includes this middle name (if it's provided), followed by a space. If no middle name is given, nothing will be placed into the final document.

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

Sometimes you may want to place a character other than a space into the final document. The second optional parameter for this expression enables you to specify what this character should be.

In the following example, the script uses the SPACE expression to determine if each of the variables in the address block are answered. If so, it places the answer to the variable, followed by a line break character (rather than a space character) into the document. You can use this to place each "part" of the address on its own line.

SPACE(Address Line 1, "\l") +
SPACE(Address Line 2, "\l") +
SPACE(City, ",") + SPACE(State) + SPACE(Zip Code)