Create a Temporary Variable

From HotDocs Wiki

Jump to: navigation, search

Variables normally get their values from the answers users enter during an interview, but sometimes you may want to have HotDocs assign an answer to a variable instead of allowing the user to specify the answer. This is especially useful in computation scripts where you use variables as temporary placeholders or counters in a loop. For example, a computation that uses a WHILE instruction may initialize and increment a Number variable to determine how many times to process the WHILE loop. (The WHILE instruction is only available in HotDocs 6.2 and higher.)

Variables whose answers are set in a computation script and not saved in an answer file are known as temporary variables. When you create temporary variables, you should set the appropriate options at the Advanced tab of the Variable Editor to cause HotDocs to treat them differently. In particular, the following three options should normally be cleared:

Option What happens when this option is cleared
Ask automatically The variable will only be asked when it is in a dialog that is specifically asked (or one asked using an ASK instruction). Since temporary variables are usually not in dialogs, this prevents them from being asked.
Warn when unanswered HotDocs will not warn the user if the temporary variable is unanswered at the end of assembly. Since temporary variables are answered using SET instructions in computation scripts, they should never be unanswered at the end of assembly anyway.
Save in answer file This prevents a variable’s answer from being saved in the answer file. Since the answers for temporary variables are usually determined from answers of other variables, there is no need to save these answers. This also keeps HotDocs from marking the variable as answered and prompting the user to save the answer file.

To create a temporary variable

  1. Create a new variable and edit the variable component. The Variable Editor appears.
  2. Click the Advanced tab. The dialog box changes to show several advanced options.
  3. Clear Ask automatically, Warn when unanswered, and Save in answer file.