Creating a Local Variable
You can create local variables to serve temporary or special purposes in specific computations or dialog scripts.
To Create a Local Variable
- Open the Computation Editor or the Dialog Editor for the specific computation or dialog you wish to use your local variable in.
- In the Script tab, click the Add Local Variable button located above the script editor.
- In the New Local Variable dialog, enter a name for the local variable, select a type of variable the local variable will represent from the drop down list, and click OK.
- The local variable is now listed in the Locals section of the Script tab, enabling you to drag and drop the local variable into the script as necessary.
You can reorder (or remove) a local variable from the Locals list by right clicking on a local variable and selecting the operation from the menu.
You can define a local variable that has the same name as a regular variable elsewhere in the component file. In such a situation, HotDocs recognizes the local name before looking for the other component. For example, suppose you have a computation variable that defines a local variable called “Temp Number,” and there is also a Number variable called “Temp Number” defined in Component Manager. If you refer to “Temp Number” within the computation where the local is defined, you will get the local answer associated with it. However, referring to “Temp Number” in the template, or in another script, will retrieve the regular answer from the answer file.