In the previous tutorial, you were introduced to the four types of information that HotDocs understands, or the four data types. In this tutorial we get hands-on experience seeing how HotDocs interprets and uses each of these kinds of information.
Section 1: The Computation Variable - Let the Title Be Your Guide |
In HotDocs, create a new computation variable. Call it whatever you wish. This is for experimentation as we go along. If you do not know how to create a computation variable, just edit a HotDocs template or create a new template (your manual will explain this), click the Insert Variable button on the HotDocs toolbar (it looks something like this: « » ), and select Computation.
When you create the computation, you will see a dialog that has a large text-entry area. This is where you create the script, or the computation. The first thing that you should notice is the title bar at the top of the dialog. It should say [Text] or Text Computation Variable.
In turn, type each of the following in the script area (removing the previous text each time), and notice how the title bar changes:
|
Computation Variable Basics. You have created your first HotDocs scripts. We are working in the "computation editor" because it is an area where we can work interactively with HotDocs and get immediate feedback.
You have now seen that HotDocs can understand four types of information: text, numbers, dates, and true/false values. Note that HotDocs automatically recognizes what kind of information you are working with. As you saw in the previous exercises, as you changed the type of data or information you fed to HotDocs, it changed the title bar accordingly.
What you have been creating is called a computation variable. In other words, it is data that is computed from values, formulas and commands that you provide. The result or output of a computation variable is a value that is suitable for use in your document. As an aside, try the following:
Type your favorite food or dessert in the script area (remember to put it between quotation marks). You now have a text computation. Click on the down arrow of the drop-down list called "Format Example" or "Default Format" and notice that the formatting models are appropriate for formatting text. Select "LIKE THIS" and click the "Test" button. You will see the result of the computation formatted in ALL-CAPS.
Replace the computation script with your birth date in proper date format (DD MMM YYYY). Inspect the "Format" options again. They are now date formatting models. Select one and then click "Test" to see what value is returned by the computation. Try a few formatting examples.
Now change the computation script to any number you wish. Inspect the "Format Examples" and notice that they are now appropriate for number formatting. "Test" a few of these.
Section 2: Providing Changeable Data |
In your computation editor, select Text on the drop-list called "Variables" or "Components." Click the New button by the list. A variable creation dialog will appear. For Variable Name type TextVar. For Prompt, type Enter some text. Click OK.
Repeat the above procedure, selecting Date, Number, and True/False on the list and creating a New variable for each, calling them DateVar, NumVar, and TFVar, and giving each Prompt text appropriate to its data type ("Enter a number," etc.).
In turn, type each of the following values in the script area (replacing the previous text each time), and notice how the title bar changes:
|
In all of our examples until now, we have used static information, meaning that the dates, text, numbers, etc. were typed directly into the computation and would never change. This is not very useful in real life. This section introduces variable information, or in HotDocs jargon, variables. A variable is a holder for a specific type of information: text, number, date or true/false. As a holder, its contents can change. You might think of a variable as an empty box that can be filled, emptied, and re-filled. The contents usually come directly from the user, as you saw above.
When you use a variable in a computation, it is exactly as if you had placed a text, number, date or true/false value in the computation. When HotDocs encounters the variable, it will ask the user what the value should be. This value is then used in place of the variable. We will cover variables in much greater depth later on.
Section 3: Remember the RESULT |
In turn, type each of the following values in the script area (replacing the previous value as you go), and click the Test button to see the computation's result.
|
The main purpose of a computation is to manipulate information. In other words, it computes new information based on the information you give it. In HotDocs jargon, the computed result is known as the computation's Answer or Result. The answer may be some new text, a new number, a new date, or a true/false value.
There is an important lesson to learn about answers from the exercise above, so take careful note of it: a computation's answer is replaced every time you give it new information. That may well go against your sense of reason. In mathematics, an answer is cumulative. But not so in HotDocs. The computation's answer is replaced every time you provide new information. Forgetting this one point has caused endless grief for beginners.
|
That covers the fundamentals. Now we will look more carefully at each type of information, or data type: text, number, date, and true/false.
• • • • • • •