The HotDocs Computation Archive

Tut. 01 - Data Types


Description:

A primer on the four types of information (data) in HotDocs: Text, Number, Date, and True/False.

 

• Introduction •

Most HotDocs guides, and most users for that matter, start on the document side of HotDocs ("How to insert a variable") and put off computations and scripts until the end ... if they get covered at all. The result is script-phobia: "I know I should use a computation for this, but ... "

In our opinion, HotDocs programming has been approached backwards. Users have been thrown into the foreign realm of HotDocs without any lessons in the language of the land.

These tutorials aim to approach HotDocs differently. We start in computation variables and never really leave. That is because our focus is not on the geography of HotDocs ("On our left is a multiple choice list ..."), but on the language of HotDocs which, once mastered, gives the user free reign over their documents.

The Lanugage of HotDocs. The language of HotDocs is, in truth, a programming language. Now there are many kinds of programming languages, and the HotDocs language falls into the category of "scripting" languages. This means that the program interpreter (HotDocs) reads the "script" every time it runs and turns it into computer instructions. We will often refer to a chunk of HotDocs code as a script.

As languages go, HotDocs is a wonderful one to start with. Its makers have taken great pains to make it as close to spoken English as they can. And they have kept the "vocabulary list" as brief as possible. Granted, it is still quite foreign to first-timers; but these tutorials should get you well over the learning curve.

Learning by Example. You cannot learn a new skill by reading a dissertation. New skills are best gained by repetitive practice with feedback. This is the approach we have taken with these tutorials. New principles are presented with a brief introduction followed by a lengthy series of exercises. The exercises themselves teach the fine details of the principle and give immediate feedback. As you work through these exercises, the principle will become clear very quickly. At the end there will be an explanation where necessary to tie it all together. But you will find that the bulk of your learning comes from the exercises. You will also find that this is a very rapid way to learn.

 
 
Section 1:  The Four Data Types

There are four types of information in HotDocs: Text, Date, Number, and True/False. Each type of information is treated differently by HotDocs. For example, numeric information can be used to perform arithmetic. Date information can be used to calculate time spans or new dates.

The following exercise will introduce you to the four types of information that HotDocs understands, or the four data types. Look at the item on the left and try to determine what type of information it is: Text, Date, Number, or True/False. Check your answer on the right.

 
What Is: Answer:
"Peach Cobbler" A string of text
"Apple crisp with ice cream" A string of text
Chocolate Nothing
Chocolate Cake Nothing. Strings of text must be enclosed in quotation marks
"Apple pie " + "ice cream" A string of text: "Apple pie ice cream"
"Apple " + "cider" A string of text. Adding two strings of text together produces a single string. They are the same as: "Apple cider"
"Apple pie" + " and " + "ice cream" The string of text: "Apple pie and ice cream"
"12345" A string of text
"123" + "4" Two strings of text added together. They are the same as: "1234"
"123" - "4" Nothing.
"123" - "3" Nothing. You cannot subtract text from text. Arithmetic is only for numbers
123 A number
0 A number (... well, a number data type)
.125 Nothing
0.125 A number. Decimals must always be preceded with a number or a zero
123.5 A number
-123 A negative number
1,234 Nothing
12,345,678 Nothing. Numbers cannot have commas (thousands separators). In fact, numbers will only accept a 1) decimal or 2) a negative sign, or 3)a currency symbol
1234 A four-digit number
$1234 A four-digit number (currency symbol ignored)
-1234.56 A negative, decimal number
123 + 4 Two numbers added together: 127
123 + 4 + 5 Three numbers added together: 132
123 - 3 One number subtracted from another. They are the same as 120. You may perform math operations on numbers
"123" - 3 Nothing
123 + "4" Nothing. You cannot add a string to a number. Arithmetic is only for numbers
"November 1, 1967" A string of text
"11/06/1967" A string of text
06 NOV 1967 The date value November 6, 1967
NOV 06 1967 Nothing
6 NOV '67 Nothing
6 NOV 67 Nothing. A date must be in the format: DD MMM YYYY, where "mmm" is the first three letters of the month's name (JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC)
01 jan 2001 Nothing
25 dec 2001 Nothing. The month must be in all-caps
1 JAN 2001 Nothing
01 JAN 01 Nothing
01 JAN 2001 New Year's Day, 2001. Again, a date must be in the format: DD MMM YYYY
26 NOV 1957 - 30 Nothing
25 DEC 2001 + 1 Nothing. Arithmetic is for numbers
25 DEC 2001 + 1 DAY December 26, 2001. You can add and subtract DAYS, MONTHS, and YEARS. More on this later
"TRUE" A string of text
"FALSE" A string of text
TRUE The true/false value TRUE
True Nothing
true Nothing
FALSE The true/false value FALSE
false Nothing. TRUE and FALSE must be in ALL CAPS
1 = 1 The true/false value TRUE
1 = 2 The true/false value FALSE
 

• Review •

You should now have a general feel for the four data types in HotDocs. Go through the following drill to solidify what you have learned.

 
What Is: Answer:
FEB 14 1974 Nothing
14 FEB 1974 Valentine's Day, 1974
14 feb 1974 Nothing. The month must be in all-caps
1 JAN 1976 Nothing. Dates must be in the format DD MMM YYYY
01 JAN 1976 New Year's Day, 1976
"TRUE" A text string
TRUE The true/false value TRUE
True Nothing
false Nothing. True/false values must be in all-caps
2 = 6 The true/false value FALSE
3 + 3 = 6 The true/false value TRUE. Complete equations return TRUE if the answer is correct or FALSE if it is wrong
3 + 3 The number 6
6 - 2 The number 4. Equations without an answer return the answer
9.1 + .9 Nothing
9.1 + 0.9 The number 10
-1 + 1 The numeric value 0
1,000 + 100 + 10 + 1 Nothing
1,000 Nothing. Numbers can only be punctuated with a decimal or a negative number
1000 + 100 + 10 + 1 The number 1111
"2" + "2" The text string "22"
"Catch" + "22" The text string "Catch22"
"Catch" + 22 Nothing. Numbers and text strings cannot be added
Catch + 22 Nothing
Catch Nothing. Text strings must be enclosed in quotation marks
"Catch" The text string "Catch"
"Apples" = "Oranges" The true/false value FALSE; the strings do not match
"Apples" = "Apples" The true/false value TRUE; the strings match character-for-character
"The End" = "THE END" The true/false value TRUE. Capitalization is irrelevant when comparing text strings
Finally, what is the rule for when capitalization matters and when it does not matter? All HotDocs keywords must be in all-caps: TRUE, FALSE, AND, OR, JAN, FEB, MAR, etc. Keywords are words that have special meaning to HotDocs. Capitalization within text strings is irrelevant. "STRING" = "string" will always be TRUE
 

In the next tutorial we begin to apply this to computation variables.


•  •  •  •  •  •  •

 

• Contributors •

LegalCS