A variable is a type of component that represents an unknown value; you can define how to gather that value from a template user, how HotDocs stores that value as an answer, and the format HotDocs gives that answer when assembling a document. For example, if you want to ask a template user for a date of birth, you would create a Date variable in your template to capture that specific type of data; you can also set format properties on that variable that tell HotDocs to place that date in your assembled document in a numerical format, or you can format a date answer as text.
In this topic Hide
In HotDocs, the term variable acts as an umbrella term to describe components you create to represent unknown content in your template (i.e. the values yet to be entered by the template user or computed by a computation). You can create variables using the HotDocs Field Editor or Component Studio. Variables are typically:
There are seven types of variables, each designed to capture values of different types from the template user during an interview:
Variable Type | Description | Example Value |
Text variable | Represents an unknown text value, such as a client name or business address. | 85 South Street, Hobble Creek, Utah |
Number variable | Represents an unknown number value, such as currency, decimal numbers, or other amounts that can be calculated. | 23.50 |
Date variable | Represents an unknown date value, such as a birth or loan commencement date. | 05/05/1990 |
True/False variable | Represents an unknown true/false value, such as the answer to a yes or no question (and often used when creating a conditional region). | True |
Single Select variable | Represents a single unknown selection from a list of values (options). | Female |
Multi Select variable | Represents one or more unknown selections from a list of values (options). | California, Utah, and Georgia |
Table variable | Represents one or more rows of unknown values arranged into columns whose names and types you define. | John Smith, 555-55-5555,
Father
Jane Smith, 555-55-5554, Mother |
In addition, there are also local variables, a specific kind of variable you can create when using HotDocs scripting to add additional functionality to a computation or dialog. Local variables can be either text, number, date, or True/false type, and are called "local" to indicate their purpose, which is to represent an unknown value pertinent only within computation or dialog script.
Like other components, variables contain properties that you can set to define how they perform in your template and are grouped together throughout the Author interface. You can review these properties below.
Among others, variables enable you to accomplish the following common tasks:
When you create a template from an existing document, the existing document usually contains placeholder text for the content that is unknown. To enable template users to provide the values for this unknown content (or to compute it using a computation), you:
You can create a variable in Component Studio or when adding a placeholder using the HotDocs Field Editor. Whichever method you use to create a variable, you can set properties to define how they perform in your template. For example, you start by setting the Name property for the variable, which is used to identify the variable throughout Author (and also in the answer file). You can then set as many properties as you need, for example:
Once you have set all of the variable properties you need, you can also group related variables into dialogs to ask multiple interview questions at once and to otherwise improve the usability and flow of an interview. Lastly, you need to ensure that you have added placeholder fields in your template that reference the variables you created and edited (and that they are in the correct locations in your template and are referencing the correct variables).
At any stage during variable creation or editing, you can use the test feature to ensure the variables you create will behave as you desire when the document is assembled.
As mentioned above, every variable has properties that you can set to define how they perform in your template. You can edit these properties In Component Studio (and in the pop-up variable editors you can open from the Field Editor). In these editors, similar properties are grouped together and (in many cases) organized into tabs. For example, all variables types have the following property groups:
Variable Property Group | Property Group Purpose | Variable Editor Location |
Component identity properties | Enables you to define how the variable is identified when authoring a template (such as the Name and Option source properties). | Top of Variable Editor |
Display | Enables you to define how the variable appears to the template user during the interview (such as the Prompt property and Style on regular dialogs properties). | Display Tab |
Behavior | Enables you to define how the variable behaves during the interview and how HotDocs processes the variable during document assembly (such as the Warn When Unanswered and Default format properties). | Behavior Tab |
Notes | Enables you to define how you want to remind yourself about the component and its role in the template (the Notes property). | Notes Tab |
Additional information | Enables you to provide information (text or URL) to help template users better understand or to give directions for how to answer a question in an interview (the Additional information property). | Bottom of Variable Editor |
The variable properties that you can set depend on the variable type. For example, a number variable has a display decimal place property while other types of variables do not. To learn about each variable type's unique properties see the following individual variable component editor topics:
You must give a variable a unique name within the template: variables in the same component file cannot have the same name, even if their variable types differ. This is because HotDocs uses the variable name to identify individual variables when generating an interview or assembling a document.
Because variables and placeholder fields work so closely to accomplish the purpose of your template (and because both have their own set of similar properties), it can be easy to confuse variables and placeholder fields. To better understand how variables and placeholder fields interact, consider the following:
You can refer to a single variable any number of times using any number of placeholder fields. For example, assume you have created a template from a document where an employee's full name is needed in five different locations. To accomplish this, you only need to create one single variable, EmployeeFullName. Once the variable is created, you then add placeholder fields in each of the five locations you want to reference the EmployeeFullName variable. There is no need to create different variables for each instance of the employee's full name and, using field properties, you can still use the same variable even when you need to the employee full name to display differently in each location. For example, by setting the format property at the field level, you can format the EmployeeFullName variable in all caps in one location, have the name display in the assembled document exactly as entered by the template user in the interview in another location, and more.
To better understand variables (and HotDocs in general) it is useful to know the technical relationship between variables, values, and answers. For example, a value is a piece of data of a type that HotDocs knows how to process, a variable is a component you can use to collect a value from template user, and an answer is a value that HotDocs stores for later use. Since you do not know (in most cases) what values your template user will enter in during an interview, variables are said to represent unknown values. However, once a template user types their response to an interview question, their answer (now considered an answer value) becomes associated with the variable. Variables, values, and answers are also related in the following ways:
You can also use variables to control how an interview's answer is displayed in an assembled document, regardless of how the template user originally typed the answer. You can achieve this by setting a variable property—the Default format property. When you set a default format for a variable, HotDocs sets the format for every placeholder field that references that variable throughout the template. To assist you in using formats, HotDocs provides a set of commonly used formats when you install Author (which you can manage in Workspace Explorer > Options > My Formats). Should you need a format not included in the commonly used formats, you can create your own custom format.
You can also set the format for an individual placeholder field using the HotDocs Field Editor (doing so overrides any default format you set). See Formatting an Answer for more information.
Each variable has display properties that specify the text used to identify the variable in the interview. These are the Name, Title, and Prompt properties you see when editing a variable in Component Studio. Each property displays text in a different location in the interview. For example, the prompt text typically appears next to the variable's answer text box; the title text typically appears in the answer summary. See Component Type and the Presentation of Prompts, Titles and Names in HotDocs Interviews for more information.
Among others, the following reference topics may relate to this conceptual area: