True/False Variable Overview
A True/False variable is a type of variable that represents an unknown true/false value. For example, if you want to place a certain word or phrase into the assembled document based on the template user's answer to a yes or no question, you would create a True/False variable to capture the template user's yes or no response.
Overview
In HotDocs, a True/False variable is a component that represents an unknown answer to a true/false question in your template (i.e. a true/false value, such as). While you can use a True/False variable to capture true/false answers, the true/false is variable is most useful for creating conditional regions (e.g. a section of a document you want to include based on a template user's answer, such as whether or not they are married or have children.) You can create True/False variables using the HotDocs Field Editor or Component Studio and True/False variables are typically:
- Referenced in the template by adding a placeholder field, indicating where HotDocs must place the variable's true/false value in the assembled document
- Added to a dialog, so the variable's question appears in the interview; template users can then type the value allocated to the variable
- Used in a computation to supply an item of data used by the computation's script
Like other components, True/False variables have properties that you can set to define how they perform in an interview and how HotDocs processes the Date variable in an assembled document. In fact, True/False variables have a number of unique properties, which you can review below.
Common Tasks
Among others, True/False variables enable you to accomplish the following common tasks:
- Adding a Placeholder Field for a Variable
- Creating a Prompt for a Variable
- Formatting an Answer
- Editing a Component
Workflow
When you create a template from an existing document, the existing document usually contains sections that you would include or exclude based on the template user's answer to a true/false question. To enable template users to provide their answer to the true/false question and to have a section of your template included or excluded based on that answer, you:
- Create new True/False variables to represent the individual unknown true/false values (either in the Field Editor or Component Studio)
- Highlight the content in your template follow the rest of the steps for creating a conditional region
When creating a True/False variable, you can set properties that define how to gather the true/false value from a template user, how HotDocs stores that true/false value as an answer, and how to format that answer when assembling a document. For example, you start by setting the name property for the True/False variable, which is used to identify the True/False variable throughout Author and in the answer file. You can set the Prompt property to provide instructive text (as opposed to the True/False variable name) to help a template user answer a question during the interview. You can also set the Default format property to define the pattern that HotDocs uses to format the template user's answer in the assembled document (such as). Lastly, you can then group related true/false (and other) variables into dialogs to improve the usability and flow of an interview.
Once you have created the True/False variable and set all of the properties you need, you can use the test feature to ensure the variable will behave as you desire when the document is assembled.
True/False Variable Properties
Like all variables, True/False variables have properties you can use to edit how the True/False variable appears in an interview, how the True/False variable is processed during assembly, etc. In addition to the properties common to all variables, True/False variables has the following unique property:
- Yes/No on same line – Enables you to place the Yes and No options on the same line in the interview.
When to Use True/False Variables
To better understand when to use a True/False variable (as opposed to the other types of variables), consider the following:
- Although you can use single select variables to achieve the same functionality as true/false variables, True/False variables are quicker and easier to add to your template because:
- True/False variables do not require you make an option source in order to ask your template users a Yes or No question
- True/False variables do not require you make an option source in order to create a conditional region (e.g. a section of a document you want to include based on a template user's answer, such as whether or not they are married or have children).
- Should you need to use HotDocs Scripting to achieve specific functionality, scripting using True/False variables is quicker and easier
- In terms of presenting options to the template user in an interview, a True/False variable can only present Yes or No as the options to choose from. If you would like to present other options (such as True and False or Yes, No, and Other you can use a single select variable).
True/False Variables and Formats
When working with True/False variables, there are times when you may want to control how a template user's answer to an interview question is displayed in an assembled document. HotDocs enables you to make such modifications to answers based on True/False variables using true/false formats. For example, although the template user can only choose from Yes or No as their answer to a question based on a True/False variable in the interview (and that the default assembled value is True or False) you can use true/false formats to have an answer of Yes appear in the assembled document as yes or an answer of No appear in the assembled document as false. To assist you in using true/false formats, HotDocs provides some commonly used number formats when you install Author.
You can either format a single instance of the placeholder field that references the variable, or you can format every placeholder field that references that variable throughout the template. You can also create your own custom format, should you need a format not included in the commonly used formats.
For more information on formats, you can read the Formats Overview and the Formatting an Answer document for more information.
Common Reference Topics
Among others, the following reference topics may relate to this conceptual area: