Computation Editor
You use the Computation Editor in Component Studio to create and edit scripts in computations to accomplish tasks such as defining a custom interview, or calculating values that you can place into assembled documents.
To access the Computation Editor, you can:
- In Component Studio, click New > Computation to create a new computation
- Click on an existing computation in from the components list in Component Studio
- Open a computation in a pop-up editor by clicking the Edit Component button in the Field Editor
Common Tasks
- Creating and Adding a Computation
- Defining a Custom Interview Computation
- Generating a list from a repeated dialog
Component Toolbar
Basic component actions appear in the component toolbar, above the component properties.
Button | What it Does |
Test | Displays the selected component in the HotDocs Test Browser. |
Rename | Displays the Rename
Component dialog box that enables you to rename your component
and perform other rename-related options.
The Rename button is not available from the pop-up editor (the editor invoked from the Field Editor). |
Duplicate | Displays the Duplicate Components dialog box that enables you to create a copy of this component in the component file. |
Tools | Shows or hides the Tools pane on the right. |
Delete | Displays the Delete Component dialog box that enables you to delete the component. You can also view a list of templates or components that currently reference the selected component and you may have to fix after deletion. |
Component Identity Properties
At the top of the editor you can see the name that HotDocs uses to identify this computation, the expected result type, and any parameters.
Property Name | What it Does |
Name | Enables you to view and edit the name of your component. This field is editable for a component that is not referenced by a template or other component; otherwise, it is a non-editable box containing the name of the component. If non-editable, use Rename in the component tool bar. |
Result type | Enables you to select an output type for your computation from:
If you set the result type of the computation you create to anything other than None, and the computation doesn't return a value of the Result Type you select, HotDocs shows an error and underlines the location in your script in red. |
Parameters | Enables you to Create new parameters, view a list of existing parameters, and perform the following parameter-related functions:
Rearranging the parameters list (Move Left or Move Right) or removing the selected parameter this will affect any templates or other components which reference this computation. |
Script Tab
You can use the script tab to create a HotDocs script.
In addition to the interface elements below, if you start typing in the Script tab, HotDocs uses an auto-complete feature to help you write correct syntax.
Element | What it does |
Find (CTRL+F) | Opens the Find dialog so you can search for specific text within your script. Check boxes enable you to search based on the case of the text you type, as well as searching for entire words.
Alternatively, search your script by pressing Ctrl+I, and then type the text you want to find. If the search finds the text, pressing Ctrl+I again searches for another instance of the text lower in your document, while pressing Ctrl+Shift+I highlights the previous instance. |
Find Next (F3) | Enables you to search your script for another instance of the text you already searched for using the Find dialog. Check boxes enable you to search based on the case of the text you type, as well as searching for entire words. |
Find and Replace (CTRL+H) | Opens the Find and Replace dialog, so you can search for and replace text within your script. |
Line numbering | Adds (or removes) line numbers to the script editor. |
Go To | Enables you instruct HotDocs to place the cursor at the line number or character position you provide. |
Auto format | Indents matching pairs of instructions based on the level of their insertion. |
Indent block | Indents the selected block of text. |
Unindent block | Unindents the selected block of text. |
Comment block | Tells HotDocs to ignore the selected block of script. |
Uncomment block | Tells HotDocs to remove the comment tag on the selected block of script. |
Export computation | Places the computation on your clipboard so you can paste it into a different script editor or use it externally (e.g. in an email or text file). |
Locals | Enables you to create new Local variables, view a list of existing Local variables, and perform the following Local variable-related functions:
Rearranging the Local variables list (Move Left or Move Right) or removing the selected variables this will affect any templates or other components which reference this computation. |
Additional Information Expander
The Additional information expander, located at the bottom of the component editor, enables you to open the additional information pane so you can edit the additional information property:
Property Name | Explanation |
Additional information | Enables you to provide supplemental help text (or an external
URL) to help your template
users better understand how to answer a question in an interview. Template users access
this information by viewing the additional information pane in
the interview
interface.
You can use HTML and CSS in the text box to format the text that displays in the additional information pane in the interview. As such, if you want to preserve angle brackets in your text (for example, <Your Name>) you must use the codes < and > to insert the brackets (for example, <Your Name>).
|
To provide you a quick way to know if this pane contains any content, the content (if any) is summarized to the right of the pane's label.
Behavior Tab
The Behavior tab provides you with properties that enable you to change how a component behaves during assembly:
Property Name | What it does |
Default format |
Enables you to set the format for every placeholder field that references the computation throughout the template. The format you select formats the computation's resulting value when the resulting value replaces the computation's placeholder field during assembly; for example, you could use the 'nine' number format to spell out a numeral you compute using the SUM function. Setting a default format does not override any formats you have already (or will) set for an individual placeholder field using the HotDocs Field Editor. |
Default unanswered text |
Enables you to specify what text you want HotDocs to merge into the final document when a user leaves the variable unanswered. This text overrides the Unanswered variable placeholder users can select in the Template Properties window. |
Pad answer to fixed number of characters | Enables you to change how answers are displayed in the assembled document by altering the padding of the answer according to the characteristics you specify using the following properties:
The default fill character is a space. |
Notes Tab
To provide you a quick way to know if this tab contains any content, you can see a + symbol on the tab if there is a note.
As you create components, you may want to include notes to remind yourself of decisions you made when creating the component. For example, maybe you need to remember information about restrictions you applied to a Number variable, or remind yourself of the purpose of the component in the template.
The notes tab enables you to type any notes you want about the component and its role in the template.
This information is not visible in the interview; it is for the author’s reference only.
Tools Pane
On the right side of the component editor you can view a tools pane containing various (Components, Models, Used in, or Field Editor) tabs for this component.
You can use the Tools button on the Component toolbar to show or hide the tools pane.
Components Tab
Displays a filterable list of components contained in the component file.
Right-click on a component in this list to view a quick actions menu that enables you to: Edit, Rename, Cut, Copy, Paste, or Delete a component.
Element | What it Does |
Search box | Enables you to quickly locate components within the component file that you can add to the current component. As you type, search results display immediately. You can clear the search box by clicking X. |
Filter (Available Components) | You can filter your search results by the following parameters you select the various options:
All Components – displays all components in your component file Available Components – displays only the variables in your component file that are able to added to the dialog
|
Sort (drop-down arrow) | Enables you to sort the component file's components. You can choose between the following sort options:
|
Select Multiple |
Places check boxes to the left of each component name (and also adds Select All and Deselect All buttons below the components filter) so that you can perform the actions available to you in the right-hand pane (rename, delete, etc.) on more than one component at a time.
You can also select multiple components in the component list pane using the same keyboard shortcuts you would. |
Create | Enables you to create a component depending on the type you select in the drop-down list.
If you set the Filter (All Components) on the left to a given type, the create button displays and creates this type when you click the create button. |
Component list pane | Displays the contents of the component file according to search parameters, sorting, and any filters or multiple selection you apply. Select a component from the list to view it in the right pane, or double-click a component to pin it open for editing. |
Models Tab
Displays the list of instruction and expression models that are available for you to use in this script. To add one or more models to the script, drag and drop them into the script editor. Then you can drag items from the Components tab or Locals tab and drop them on the model placeholders to complete the line of script.
You can see different models in the expanded lists depending on whether you are creating a computation or a dialog script. Two expanders, Dialog Instructions and Dialog Validation Functions, are only available in when you are creating a dialog script.
Locals Tab
The Locals tab appears in the Tools pane after you create at least one local variable or parameter for your script. This tab contains the local variables and parameters that are available for you to use in the current script. You can add a local variable or parameter to your script by dragging and dropping it from the right pane into the script editor.
To reorder parameters, right-click in the parameters section of the locals tab and click Move Up or Move Down. Because a computation containing parameters may be used in multiple locations, be careful when rearranging the parameters. The computation may depend on the parameters being answered in a certain order to make a script work, so changing the order may cause the computation to malfunction elsewhere.
You can only insert a parameter when working with a computation script. Parameters are not available for dialog scripts.
Info Tab
When you select a component in the Components column of Component Studio, you can look at the Info tab on the far right of the component editor to see the type of the currently selected component, as well as a list of other components or templates (if there are any) that use the component you select.
Element | What it Does |
Type | Displays the type of the component you selected in the Components column. |
Used in | Displays a list of other components or templates (if there are any) that use the component you select. Double-clicking an item in the Used In section opens that item for editing, and places focus on the first reference to the component you selected in the Components column. |