HotDocs Author WorkflowCreate a template Add placeholders Group variables in dialogs Upload a template Create a script

HotDocs Scripting Language Overview

The HotDocs scripting language is a HotDocs Author-specific computer language you can use to tell HotDocs to accomplish certain tasks in your templates and interviews. For example, if you have questions in your interview that do not apply to minors, you can use a script to hide all such questions when a template user provides a date of birth indicating they are under eighteen years of age.

Overview

In barest terms, the HotDocs scripting language exists to enable you to add mathematical and logical operations to your template and interview. The mathematical capability of the scripting language enables you to calculate values you need to supplement answers your template users provide in an interview. The logical operations enable you to perform tasks such as exposing or concealing portions of your template or interview based on your template user's answers in the interview, or enabling you to gather a list of answers from a single question. You can review the different types of operations available in the language in the Full List of Instructions, Functions and Operators topic.

Two Kinds of Scripts

The focus on the two different purposes in crafting a script (calculating values, and crafting logical operations) leads to two different kinds of scripts:

  • Computations – Enable you to calculate a value of a given type, and to encapsulate requests for answers and other similar tasks into a reusable set of instructions and expressions in a way that makes your template and its flow easier to read, understand, and maintain. HotDocs stores computations in your template's component file which you edit in the Computation Editor. You can reference a computation from a placeholder field.
  • Dialog scripts – Enable you to control how or under what conditions, various elements appear in your interview  (the flow of your interview). You can only create and reference dialog scripts within a Dialog Editor

The difference between these two types of scripts can be a bit blurry due to the existence of interview computations for Answer Intakes, and because you can calculate a value within a dialog script.

Common Tasks

Among others, the HotDocs scripting language enables you to perform the following common tasks:

Workflow

While you can create elements of a HotDocs script within individual HotDocs fields, you can only create a true HotDocs script within a computation component, dialog component, or an answer intake. This means that to create a script, you first must create a dialog or computation, then open the component for editing within Component Studio. Each of these components has a Script tab where you write your scripts. While the Script tab is initially blank, there are many aids (described below) that HotDocs provides to help you learn to write scripts.

The Parts of a Script

In HotDocs Author, a script is a set of directions that tells HotDocs to perform an action or calculate a value. If you were to relate this to writing a human language, you could equate a script with a coherent paragraph on a given topic. A paragraph consists of building blocks called sentences. You can define a sentence as the smallest element of writing that expresses a complete thought. In the same way, a script consists of building blocks called statements. A statement is the smallest syntactic unit in the HotDocs scripting language that tells HotDocs to complete a task or to calculate a value.

You can carry this metaphor further. In a human language, a sentence contains building blocks of different types such as nouns, verbs, adjectives, conjunctions etc., which you combine into a sentence with a subject, object, and verb. Similarly, in the HotDocs scripting language are smaller syntactic elements you can combine to create a complete statement.

In addition, just as you can create a complete thought in someone else's mind by implying some elements of a sentence, there are some elements in the HotDocs scripting language that perform a similar role. For example. if you see a small child you don't know toddling towards some danger, you might simply yell "Stop!" Implied in that command is the following more complete thought: "Hey, you, stop walking (towards that road), or you'll get hurt!" This sentence has a subject (you), object (the road), and verbal (get hurt), as well as several other elements that are merely implied, rather than stated overtly. Some items in a HotDocs script can work in a similar way. Consider the system function TODAY. While the keyword TODAY is both the name and the whole body of the function, there is an implied series of commands that use your computer's system clock to return a date value that corresponds to today's date. You wouldn't often use this function as an entire statement within a script, but in principle, you could. Similarly, you might build an entire script from a single statement, just as you could conceivably craft a single sentence that reads like a paragraph. In general, however, a script consists of more than one statement.

 

Language Elements of a Statement

Statements can consist of a single expression or instruction, or, it can include a combination of one or more expressions or instructions. These two kinds of building blocks work slightly differently. You can think of these scripting building blocks in this way: instructions and expressions enable you to tell HotDocs what to do, the functions and operators tell HotDocs how to do it, and the values tell HotDocs what to do it to, as well as alerting HotDocs to the outcome of the actions taken.

Statements Based on an Instruction

At the root of a statement using an instruction, is the instruction keyword, which you can relate to a verb in a human language. Sometimes an instruction works in harmony with another keyword to act on components or values, which you can compare to pronouns or nouns in a human language:

  • Instructions – keywords in the HotDocs scripting language that tell HotDocs to do something to a component, such as ASKing a dialog at a specific place in the interview or using the HIDE instruction to hide a variable during an interview until the variable becomes pertinent. The keyword acts on the component, just as a verb acts on its direct object, e.g. ASK dialog X tells HotDocs to act on dialog X (by presenting it in the interview). Similarly in the sentence"Ask Susan," the verb "Ask" acts on Susan, the direct object of the verb.
  • Other key words – words that have a particular meaning in the HotDocs scripting language that cause HotDocs to generate a value or perform a task; the most notable keywords include instructions, system functions, system local variables, and operators. In addition there are other keywords that act like supplementary instructions, since they do nothing on their own. These include TO (as in SET somevar TO some value), ALL (as in HIDE ALL), etc. Since key words tell HotDocs to do something, they act as verbs, just as instructions do.
    • Components – uniquely named building blocks of a HotDocs template with attributes and rules (properties) that define their appearance and behavior in an interview, the way they handle answer data, and how HotDocs applies that data when assembling a document. Often, a component acts within a script as a stand-in for an as yet unknown value (see the discussion of value below). This is similar to how a pronoun acts as a stand-in for a noun, e.g. "He hit the ball." Who is he? We may or may not yet know, but we know he stands in for a particular male person.
    • Value – a piece of data of a type that HotDocs knows how to process. In HotDocs at any given moment, you may or may not yet know the value of a piece of data. If you do not yet know a value, you represent the unknown value with a component such as a variable, which you use to ask your template user to supply that value. Once the user answers the question the variable represents, HotDocs can store that known value as an answer. If you want to pass a known value within a script, you must use the appropriate literal syntax for that value type.
      Within the HotDocs Scripting context, values act as nouns do in human language. Nouns can act as subjects or objects within a sentence. Just as a verb can act on a noun, as in the sentence "Hit the ball" where ball is the noun acted upon, an instruction, function, operator, or other key word can act on a value, whether that is a known (literal), or as yet unknown value (variable). In the instructions example above (ASK dialog X) the instruction acts on a component (a dialog). A dialog can present one or more variables in an interview. In this way, a dialog can abstractly represent several unknown values. You can do this in human language as well in a sentence such as "Ask everyone who comes today what their name is." Here the verb ask acts on a group of direct objects whose identity is as yet unknown, just as the ASK instruction acts on the variables on dialog x.

Statements Based on an Expression

The first element in a statement based on an expression is the context in which the expression occurs. The context acts as an implicit command, which you can compare to a verb in a human language. The context acts upon the expression like a verb does to a noun phrase. An expression can be a very simple evaluation of a single variable or value, or it can be more complex, involving functions, operators, variables and values. No matter its complexity, an expression always resolves to the single value it is meant to calculate. What happens with that value is determined by the context in which the evaluation occurs:

  • Context  – a circumstance (usually based on location) that provides an overriding implicit command to an expression. In this way, the circumstance acts as a transitive verb, but only an implied one. For example, if an expression is part of a computation, the context (the expression's location within a  computation) gives the implicit command: return a value of a particular type (whatever you chose for the computation's Result type). Likewise, if an expression's context is a placeholder field, then the implicit command the context provides is for the expression to replace (during document assembly) the placeholder field with the value it calculates. Similarly, in the context of a dialog script, the implicit command to an expression is to "calculate a value, but do not do anything else with that value," since dialog scripts are meant to effect the appearance of dialogs and their variables within an interview (HIDE, SHOW, GRAY, UNGRAY, etc.), rather than to apply a value to change behavior. In its relationship to its context, an expression is similar to a noun phrase that is the object of the implied verb of the context.
  • Expressions – A single statement in the HotDocs Scripting language that calculates a single value; the statement takes the form of an evaluation of one or more values, variables, operators, or system functions. For example, the expression YEARS FROM(DateVar1,TODAY) uses the system function YEARS FROM  to calculate the number of years between an as yet unknown value your template user supplies (in the interview) for a variable called DateVar1, and the value returned by the system function TODAY. You can think of an expression as a noun phrase because an expression always resolves to some value, and a value in the HotDocs scripting language is comparable to a noun in human language; therefore, you can think of an expression as a noun phrase which receive the action of the verb implied by the context in which you create the expression.
    • System functions – A named calculation in the HotDocs scripting language that takes zero or more values as inputs (parameters) and produces a single value as a result; the HotDocs scripting language includes system functions, but also enables you to create your own functions (computations). Because a function acts as an evaluator of data, and it returns a value, it is closer to a noun than a verb. Because you can also say it evaluates any values it takes as inputs, deriving information from them to produce a final value, you can view a function's purpose in the HotDocs scripting language as similar to how an adjective modifies a noun in a human language. For example, the system function FIRST takes two parameters as inputs: a text value, and a number value indicating how many characters you want the function to count, moving from left to right and beginning at the start of the text. Suppose you provided a text value of "Mississippi" as one parameter and a number value of 5 for the number value. The function would parse the text from left to right five characters and return a value of "Missi". In this way, the function has modified the noun "Mississippi" so that now, the value is "Missi". This is of course not the usual way we think of an adjective modifying a noun; that is why functions are labeled as adjective (ish) in the diagram above.
    • Operators – symbols or words that cause HotDocs to carry out an operation (such as addition) or a comparison (such as greater than) in a computation or expression. For example, using the greater than comparison with numbers, you can evaluate which of two number values you designate is larger. Consider the expression Client Age > 18. Here you compare an as yet unknown value (a variable) called Client Age to a known value (a text literal) 18. An operator is similar to a function because it operates on two values to produce. In this case however, it does not modify a value directly; instead it compares or joins two values, just as conjunctions and comparatives do with nouns in human language.
    • Variable – a type of component that represents an unknown value; you can define how to gather that value from a template user, how HotDocs stores that value as an answer, and how to format that answer when assembling a document. Within an expression, since a variable represents an unknown value, it is a stand-in for a value. Therefore, it performs a similar function in a HotDocs script statement similar to the role a pronoun plays in a human language. For an example of this functionality, see the discussion on components above.
    • Values – see the discussion on Values under Statements Based on an Instruction, above.

HotDocs Fields versus HotDocs Scripts

A template in HotDocs Author consists of boilerplate text interspersed with HotDocs fields. Almost every HotDocs field within a HotDocs template contains an instruction or an expression, and is, therefore, a statement in the HotDocs scripting language (this includes placeholder fields referencing a variable, since this is a single variable expression). You cannot however, add both an instruction statement and an expression statement to a single HotDocs field (unless that field is a placeholder field that references a computation component, since computations can contain both instructions and expressions).

As mentioned above, a HotDocs script, is a sequence of interrelated statements composed of instructions and expressions. These fit together similarly to how sentences in a human language work together to form a coherent paragraph on a given topic. While you deal with the same HotDocs language building blocks in HotDocs fields as you do while writing a script, they are packaged differently. The statements in a script are written to complete a specific task that is likely unrelated to the aims of the next field in the template.

Another difference between the fields in a template and the lines in a script is that in the HotDocs Field Editor, HotDocs provides you lots of support to guide you through the creation of the field's statement. In a HotDocs script, while there are writing aids (covered below), you are much more free to compose your logic in whatever way seems best to you.

Accessing Values in the HotDocs Scripting Language

In order to access a value in the HotDocs scripting language, you need to know where that value is. As stated, the only permanent memory in HotDocs is an answer set. This means, you need to know the rules (syntax) for accessing this data. For example, if you want to access a particular value in a text list in the answer file, you need to use a the syntax of a list literal – [0, 1, 2]. The left bracket indicates the beginning of the list, and the commas denote the existence of individual values in the list, while the right bracket indicates the end of the list. In this example, there are three values in the list.

Dot Operators and Cell Lookup

The HotDocs scripting language also contains a special feature to enable you to access individual cells in tabular data, such as that you can create in a Fixed Table component. For instance, if you create a Fixed Table component called Employees with columns for First Name, Last Name, Birthday, Hire Date, etc., and you supply the corresponding data for the following individuals:

  • Susan Smith
  • Barney Franklin
  • WIll Frederickson

You can write a script to use Barney Franklin's Hire Date using the dot operator.

Access to a cell is case sensitive. In other words, if your column name is Hire Date, and you try to access that with hire date, the look up fails.

You use Fixed Table components (which act only as data stores) in conjunction with a Selection variable, which enables you to choose an Option Source. In this example, you would create a Selection variable, you might call Employee List, and in Employee List, choose the Fixed Table component Employees as your Option Source. Then, to access Barney Franklin's hire date, you would use the dot operator to specify the proper cell as follows:

Employee List.Hire Date

 

IF ANSWERED Employee List

SET

Write a Script

To write a script, you first need a clear idea of the actions you want HotDocs to take – say you want to HIDE a variable on a dialog until your template user responds to a related variable's prompt. You then need to think logically about the steps required to achieve this (placing the variable to HIDE within an IF condition so that it only appears if a template user's answer to the related variable meets the condition that causes HotDocs to SHOW the first variable). Once you have a clear idea of the process you want HotDocs to undertake, you need to translate those steps into the appropriate instructions, functions and operators of the HotDocs scripting language so HotDocs can accomplish the tasks you want it to.

Suppose, for example, you need some of the variables in your template to appear in the interview only if your template user is from Hawaii. One of the things your script would need to do is check the answer to a variable asking for your template user's address to see if the address is in Hawaii. If the address is in the state of Hawaii, you would then instruct HotDocs to display any Hawaii-specific variables in the interview.

In plain terms, you want to tell HotDocs to:

  1. Hide the Text variable Client Address Island unless your template user needs it.
  2. Therefore, check if the answer to Client Address State contains the word "Hawaii."
  3. If it does, show the Text variable Client Address Island.

Once you formulate what you want HotDocs to do in clear language, you can further shorten the clauses like this:

  1. Hide Client Address Island.
  2. If Client Address State contains the text value "Hawaii,"
  3. Show Client Address Island.

You can now translate this into a HotDocs script as follows:  

HIDE Client Address Island

IF Client Address State CONTAINS "Hawaii"

SHOW Client Address Island

END IF

This script syntax is very close to normal speech; however, there are some important things to remember when writing a script:

  • You must type instructions, functions and operators in ALL CAPITALS using the exact keyword HotDocs requires to recognize that you are writing a script (HotDocs provides clues to help you)
  • You must type variable names exactly as they appear in Component Studio, including any capital letters and spaces
  • You must put quotation marks around any text you want to treat a as literal text value (as with the text "Hawaii" in the example above)
  • You  must use the correct type of value (e.g., a variable or a dialog) with each instruction, function or operator, i.e. the CONTAINS instruction you see in the example above requires you to provide a text value before and after CONTAINS in order for the instruction to work – in this case, Client Address State) before CONTAINS and the literal text value ("Hawaii") after

To avoid getting into trouble with any of these rules, it is best to practice writing scripts by using script models, as in the dialog script example available below.

Important General Considerations when Writing a Script

When writing a script, to avoid errors, you can either drag and drop a model into your script, or use the lookup feature. When manually typing the script:

  • You must add component names exactly as they appear in the Components list (including capitalization)
  • You must ensure that spaces separate the names of components and any operators
  • Operators must appear exactly as they do in the Models tab, including capitalization
  • Keywords, such as TRUE, FALSE, AND, END IF, and so forth, must appear in all capital letters
  • If you want the computation to return a combination of text, variables, and values, you must concatenate (or join) the data with the Add ( + ) operator. Otherwise, HotDocs returns only the last piece of text, variable, or value.

Whenever you are creating a computation, you must ensure you set the RESULT type property to the appropriate value type for the computation to work.

You can also choose to set the RESULT type to NONE when defining a custom interview computation.

Use Script Models

When you want to write a script, you don't have to start from scratch and try to remember exactly how to format scripts. Instead, you can use a model (a pattern that teaches you proper HotDocs scripting language syntax). On the far right of the Script tab, HotDocs provides a Components tab and Models tab. The Components tab contains a list of components available in your current component file for you to use in your script. The Models tab contains a list of models that demonstrate the proper syntax for instructions, functions and operators. When you drag an instruction, function, or operator from the Models tab and drop it onto the script editor, HotDocs highlights in red (and within brackets) the parts of the models that act as placeholders for values. You can then either type information into those placeholders or replace them with the proper reference by dragging and dropping components from the list of components available on the Components tab.

The list of models changes depending on which component editor you are currently using. For example the list of available models changes between the Dialog Editor and the Computation Editor.

Looking at the example we've been following above, you can create the first line of that script by dragging the HIDE instruction from the Models list and then dragging the Text variable Client Address Island from the Components list.

Use Auto-complete

Writing a script can seem daunting when you are staring at a blank Script tab. To help you with this, HotDocs provides in-line hints to help you if you don't remember the keywords needed for instructions, functions, and operators. You initiate the auto-complete behavior by first placing your keyboard focus in a Script tab or expression editor, and then pressing CTRL + SPACE BAR.

When you do this, HotDocs displays an auto-complete drop-down list at the cursor position. You use the down and up arrow keys to change the selected element in the list. The list includes:

The above items all appear in alphabetical order.

HotDocs then inspects the word (if there are any) immediately to the left of your current cursor position. HotDocs uses any text there to filter the list so the list only displays items that include the word to the left of the cursor (as appropriate). Also, if any of the items in the drop-down start with the word found to the left of the cursor, HotDocs highlights the first such item. (If nothing in the filtered list starts with the word, the list still appears as noted, but without highlighting any item.)

If you type enough letters that the filter finds only one word that satisfies the filter (for example, OTH while eliminates all words but OTHER), HotDocs inserts this word for you. Otherwise, you can use the up and down arrow keys to move a highlight through the auto-complete list. When you press ENTER, HotDocs inserts the currently highlighted item into the script at the cursor location, and the auto-complete list disappears. You can also dismiss the list by pressing ESC, moving the selection elsewhere with the mouse, or in some other way causing the script editor to lose focus.

With the list visible, if you type or delete characters, the filtering updates as expected.

Make Your Script Easy to Read

While having a long horizontal line of script might make sense to a computer, a human reading and looking for errors may have trouble, especially as your scripts get longer and more complicated. The following is an example of what NOT to do:

HIDE  Client Address Island  IF  Client Address State  CONTAINS  "Hawaii"  SHOW  Client Address Island END  IF  

To make a script more readable, first, break it up into one action per line. Using the same example above you can break the one long line into:

HIDE Client Address Island  

IF Client Address State CONTAINS "Hawaii"  

SHOW Client Address Island  

END  IF  

You should also always leave END IF (and other END) instructions on their own lines. This makes it easier to spot sections of the script that are conditional or should in other ways be considered as a unit.

Key Off Syntax Highlighting

When you write a script in a script box, HotDocs also provides syntax highlighting to help you see when you do things properly and when you make mistakes. To do this, HotDocs combines colors and bold text to help make your script even easier to read. HotDocs uses Bold for instructions, functions and operators, blue for variables, and maroon for literal values, as follows:

HotDocs only recognizes a word as a literal value and colors it maroon if you surround the word with quotation marks. The quotation marks tell HotDocs not to evaluate this word as a variable or other script element.

HIDE  Client Address Island  

IF  Client Address State  CONTAINS  "Hawaii"  

SHOW  Client Address Island  

END  IF

To make the script even easier to read, you can have HotDocs add some useful tab spaces to your script when you click  the Format Document button. This makes it clear at a glance which sections of the script are conditional as it indents all the lines that form the conditional region.

HIDE  Client Address Island  

IF  Client Address State  CONTAINS  "Hawaii"  

SHOW  Client Address Island  

END  IF

Use Script Error Validation

In addition to the above, HotDocs provides other aids to enable you to correct errors in your script. For instance, if you make a mistake in your script, HotDocs adds a red squiggle under text that meets the following conditions:

  • Text that does not correspond with an existing variable, component, instruction, etc.
  • Misplaced operators, instructions, variables, etc.
  • White space that is out of place
  • Incomplete commands or statements

To fix an error in your script:

  • Make sure the text you entered as script corresponds to existing variables, components, instructions and operators
  • Make sure all operators, instructions and commands are correctly placed within the script
  • Make sure all commands and statements are completed (for example, you must conclude an IF command with an END IF)

Use Local Variables and Parameters as Needed

Parameters (available on computations) and local variables (available on both dialog scripts and on computations) enable you to create data points that exist only within the context of the computation or dialog script. This can be useful in keeping your component file's list of components less cluttered and more usable.

Local Variables

A local variable is a variable you create and use only within a computation, dialog script, or an answer intake as a placeholder for temporary data pertinent only with that script. Sometimes when you write a script you may find you need a temporary variable that isn't used anywhere else in your template, for example: you may need a Number variable to act as a counter when you're calculating repeats for a repeated dialog. Rather than creating a real variable that sits in your component file and clogs up your list of components, you can make a local variable that exists only in your dialog script. You need to SET the value of a local variable before you can use the variable.

Parameters

A parameter is a placeholder you create within a script to "pass in" a value external to your script. A parameter therefore enables you to provide an initial value to a computation that depends on a value outside your computation. Passing in a value enables you to encapsulate sections of a script that you may want to repeat with slight variations, or even from multiple different scripts using the value you provide as the parameter. For example, you may need multiple scripts that perform the same operation within their particular context. Instead of creating the same script multiple times, you can create a computation that takes as a parameter the value you want to operate on. In each of the multiple locations, you can then "call" the computation and "pass" the value into the other scripts as a parameter. Writing scripts in this way is called encapsulation and makes your scripts easier to read and manage, and helps you keep errors from entering your scripts.

Example Dialog Script

If you want to practice creating a dialog script, follow the steps below:

  1. Create a template, then create a dialog using Component Studio (call it Test), and finally, add two Text variables called Client Address State and Client Address Island.
  2. Open Component Studio, then double-click the Test dialog to open the Dialog Editor, and click the Script tab in the Dialog Editor.
  3. In the Models tab to the right, click to expand the Dialog Instructions list; then drag and drop the HIDE instruction onto the Script tab so you can see the model HIDE  ⟦VAR⟧.
  4. Hover your mouse pointer over the ⟦VAR⟧ placheolder. The tool tip tells about the placeholder and the types of items you can replace the placeholder with.

HotDocs cannot evaluate a model on its own. You must replace a model's placeholders with the correct type of component or value. The red text of a model tells you the type of value you need to replace it with for HotDocs to process that statement. This can be any variable (var), or one of a specific type of components (such as a, text, number, dialog, etc.), or an expression.

  1. From the Components tab (to the right of the Script tab), drag and drop the Client Address Island Text variable onto the ⟦VAR⟧ placeholder, which disappears as the Client Address Island (in blue font) takes its place.
  2. In the Models tab, open the General Instructions list and select the IF instruction; then drag and drop the IF onto a new line.
  3. Return to the Models tab and open the Logical Operators list.
  4. Select TEXT CONTAINS TEXT and drag it onto the ⟦EXPRESSION⟧ placeholder in the IF instruction.
  5. From the Components tab, drag and drop Client Address State  onto the first ⟦TEXT⟧ placeholder.
  6. Delete the second ⟦TEXT⟧ placeholder and type "Hawaii" in its place (including the quotation marks – these tell HotDocs this is a "text literal" and not a variable).
  7. Press ENTER; then click the Models tab.
  8. From the Dialog Instructions list, drag and drop the SHOW instruction onto the new line.
  9. From the Components tab. drag and drop Client Address Island onto the ⟦VAR⟧ placeholder.
  10. Press ENTER; then on the Models tab, expand the General Instructions list and drag and drop END IF onto the new line.
  11. In the toolbar on the Script tab, click the Auto Format button (this normalizes the tab spaces and indents).

Script Writing Recap

  • Write down what you want HotDocs to do
  • Rewrite your original words into short clauses
  • Translate your regular English into HotDocs script:
    • Use script models
    • Use auto-complete
  • Use one line per instruction or function
  • Put END instructions on their own lines
  • Key off the syntax highlighting and error validation to see when you write things properly, and when you're making a mistake
  • Use the Format Document button to add useful indents

Script Syntax Rules to Remember

Models are designed to help you accurately write scripts. However, there are still certain rules you must follow to make sure HotDocs understands what you want it to do. Failure to follow these rules may result in syntax errors when HotDocs attempts to process the script during assembly.

Rules for Using the Script Editor Tab

When you are creating a computation, you need to set the computation’s result type. This can be:

  • Text
  • Number
  • Date
  • True/false
  • None

If the result type you select does not match the result of the script you write, HotDocs shows an error and will not process the computation.

Rules for Replacing a Model with Literal Values

  • Decimal numbers less than one must have a zero before the decimal point (0.125 not .125).
  • Numbers cannot contain commas (1250 not 1,250).
  • You must write dates in the form 3 JUN 1990.
  • You must put text strings inside quotation marks.

Rules for Manually Typing the Script rather than Using a Model

  • You must enter component names exactly as they appear in the Components list, including capitalization.
  • You must separate components and operators by a space.
  • You must enter operators exactly, including capitalization.
  •  In a computation, you must put variables you reference inside a literal text string (i.e., between quotation marks) within brackets, as follows: "«Employee Name» must wait «Number of Months» months before applying.]

If a variable name is not within chevrons, HotDocs uses the variable name—not the variable's value—as the answer.

  • You must type keywords, such as TRUE, FALSE, AND, END IF, and so forth, in all capital letters.
  • You can only use TRUE or FALSE for a true/false value.
  • If you want the computation to return a combination of text, variables, and values, you must concatenate (or join) the data with the add ( + ) operator, as in the example provided in the TEXT + TEXT model. Otherwise, HotDocs returns only the last piece of text, variable, or value.

Tips and Tricks

  • It is important to remember when creating expressions within a DOCX template that the script elements you include in the Word template can control the final look of the assembled document.
  • When you're writing an expression in a HotDocs Field, you can use a bar "|" as a hard return. If you have smart quotes on, you can lose a hard return -- the bar ensures it stays. Another solution to this issue is to use the Preserve Empty Paragraph property in the Advanced Properties for a HotDocs Field.

Common Reference Topics

Among others, the following reference topics relate to this conceptual area: