Full List of Instructions, Functions and Operators

In the HotDocs Scripting Language there are three types of keywords:

When you use the Script tab (in the Dialog Editor or Computation Editor), HotDocs provides a Models tab containing all the available instructions, functions and operators that you can drag into your script. When you drag and drop a model into the script tab, you can see highlighted placeholders which you must replace with the correct components before the instruction will work.

Some functions have optional parameters that do not show up in the models you drag into the Script tab. They do appear in the tool tip however. Once you drag the model in, you can add the optional parameter manually if you want to access that functionality. The optional parameters also appear in the function documentation.

 

In this topic Hide

  1. Common Tasks
  2. Dialog Instructions
  3. General Instructions
  4. Dialog Validation
  5. Computation Result
  6. Answer Functions
  7. Text Functions and Operators
  8. Date Functions and Operators
  9. Logical Operators
  10. Mathematical Functions and Operators
  11. Financial Functions

Common Tasks

Dialog Instructions

The dialog instructions are only available in the script editor when you are creating a dialog script.

Instruction What it Does
GRAY The GRAY instruction stops the template user from interacting with the specified component but keeps it visible on the dialog.
GRAY ALL The GRAY ALL instruction stops the template user from interacting with any components on the dialog but keeps them visible.
HIDE The HIDE instruction makes the specified component invisible to the template user during an interview.
HIDE ALL The HIDE ALL instruction makes all of the components on the dialog invisible to the template user during an interview.
LIMIT The LIMIT instruction restricts the number of iterations a template user can add to a repeated dialog.
REQUIRE The REQUIRE instruction forces the template user to answer the specified variable in the dialog before they can move to the next dialog.
REQUIRE ALL The REQUIRE ALL instruction forces the template user to answer all variables in the dialog before they can move to the next dialog.
SHOW The SHOW instruction displays in the interview a specific component you previously hid.
SHOW ALL The SHOW ALL instruction displays in the interview all components you previously hid on the dialog.
UNGRAY The UNGRAY instruction re-enables the specified, previously grayed component, allowing the template user to interact with the component.
UNGRAY ALL The UNGRAY ALL instruction re-enables all previously grayed components on the dialog, allowing the template user to interact with them.

General Instructions

The general instruction list appears in every script editor but some options are not available for dialog scripts.

Instruction What it Does
ADD (Not available for dialog scripts) The ADD instruction enables you to add options to a multiple choice variable.
ASK (Not available for dialog scripts) The ASK instruction tells HotDocs to display a specified dialog or variable in an interview.
ASSEMBLE (Not available for dialog scripts) The ASSEMBLE instruction adds a specified template to the assembly queue.
CLEAR (Not available for dialog scripts) The CLEAR instruction removes all current options from the specified multiple choice variable.
DECREMENT The DECREMENT instruction decreases the value of a specified number variable by 1.
DEFAULT The DEFAULT instruction provides an initial editable answer for the specified variable (if it is unanswered).
ERASE The ERASE instruction deletes answers from the interview for a specified variable or dialog.
IF
  • ELSE IF
  • ELSE
  • END IF
The IF instruction contains a condition, that defines the start of a conditional region.
  • (Optional) You can add an ELSE IF instruction, which contains a condition, that adds a branch to an existing conditional region. HotDocs only processes this branching condition if the preceding IF condition is false.
  • (Optional) You can add an ELSE instruction, which adds a branch to an existing conditional region; HotDocs processes this branching condition if all preceding IF/ELSE IF conditions are false.
  • You must include an END IF instruction to define the end of a conditional region..
INCREMENT The INCREMENT instruction increases the value of a specified number variable by 1.
INSERT (Not available for dialog scripts) The Insert instruction tells HotDocs to insert the contents of a specified file at that location during document assembly.
QUIT The QUIT instruction stops HotDocs from processing any remaining script in the component.
REPEAT
  • ASCEND
  • DESCEND
  • FILTER
  • FORMAT
  • END REPEAT
(Not available for dialog scripts) The REPEAT instruction tells HotDocs to process each repetition of the specified repeat dialog.
  • (Optional) You can use the ASCEND instruction to sort a list of answers (generated from a repeated dialog) in ascending order by a specified variable from that dialog.
  • (Optional) You can use the DESCEND instruction to sort a list of answers (generated from a repeated dialog) in descending order by a specified variable from that dialog.
  • (Optional) You can use the FILTER instruction to remove entries from a list of answers generated from a repeated dialog using a specified computation.
  • (Optional) You can use the FORMAT instruction to punctuate a list of answers (generated from a repeated dialog) using a specified sentence-style format example.
  • You must include an END REPEAT instruction to designate the end of a repeated region.
SET The SET instruction specifies an answer value for a variable.
WHILE
  • END WHILE
The WHILE instruction tells HotDocs to repeatedly process a script until the condition you specify is met.

Dialog Validation

The dialog validation functions are only available in the script editor when you are creating a dialog script.

Function What it Does
ERRORTEXT The ERRORTEXT function enables you to create an error message that can appear during interviews when the end-user enters an unacceptable answer.

Computation Result

Function  
Computation RESULT The Computation RESULT system local variable that enables you to store the result of a computation while it is processed; the computation returns the value of RESULT once it is completely processed.

Answer Functions

The answer functions use the information from the way a template user answers interview questions to return new values.

Function What it Does
ANSWERED The ANSWERED function determines whether the end-user has answered a variable or dialog in the interview. If so the expression returns a value of true.
COUNT (Not available for dialog scripts) The COUNT function instructs HotDocs to count how many options the end-user selects in a Multiple Choice variable or how many sets of answers an end-user provides for a repeated dialog. The expression returns a number.
COUNTER The COUNTER function keeps track of the current number of repetitions in a repeated dialog. Every time the end-user begins a new repetition the value of the COUNTER increases by one.
OTHER The OTHER function determines if the end-user has chosen the Other or None of the above option in a Multiple Choice variable and if so returns the text they entered in that field.
SELECTION The SELECTION function returns the text value that corresponds with the selected Multiple Choice variable option.
SUM (Not available for dialog scripts) The SUM function adds together the selected repeated number values.
UNANSWERED The UNANSWERED constant enables you to clear an answer from a variable.
UNION The UNION function combines all unique options the template user selects, across two Multiple Choice variables, into a single list.
VALUE The VALUE function returns a specified default value when the selected variable is unanswered.
ZERO The ZERO function returns a value of zero when the selected Number variable is unanswered.

Text Functions and Operators

The text functions and operators manipulate and convert specified text values.

Function/Operator What it Does
FIRST The FIRST function returns the selected number of characters, starting at the beginning of a text string.
FORMAT The FORMAT function converts a date, number or true/false value into a text value.
INTEGER The INTEGER function converts the number characters in a text value into a number value.
LAST The LAST function returns the selected number of characters, starting at the end of a text string.
LENGTH The LENGTH function returns the number of characters (including spaces and punctuation) in a text string.
MID The MID function returns the selected number of characters, starting at the specified character in a text string.
POSITION The POSITION function finds the position of a specified character (or set of characters) in a text value. It returns a number value.
REPLACE The REPLACE function finds a specified character string in a text value and replaces it with new text.
SPACE The SPACE function checks if the selected variable is answered and, if it is, places the answer followed by a space character.
STRIP The STRIP function removes a specified character string from the beginning and/or end of a text value.
TRIM The TRIM function removes any space characters from the beginning and end of a text value.
TEXT + TEXT The TEXT + TEXT operator enables you to combine two text values into one text variable that can be placed into the document.

Date Functions and Operators

The date functions and operators are used to manipulate and convert specified date values.

Function/Operator What it Does
AGE The AGE function calculates the number of years between the current date (as determined by your system clock) and the specified date value. It returns a number value.
DATE OF The DATE OF function converts three given number values (that represent the day, month, and year) into a date value.
DAY OF The DAY OF function returns the day portion of a selected date as a number value.
DAY OF WEEK The DAY OF WEEK function determines on which day of the week a selected date falls and returns a number value that represents that day of the week.
DAYS FROM The DAYS FROM function finds the number of days between two date values and returns it as a number value.
MONTH OF The MONTH OF function returns the month portion of a selected date as a number value.
MONTHS FROM The MONTHS FROM function finds the number of months between two date values and returns it as a number value.
TODAY The TODAY function returns the current date (as determined by your system clock) as a date value.
YEAR OF The YEAR OF function returns the year portion of a selected date as a number value.
YEARS FROM The YEARS FROM function finds the number of years between two date values and returns it as a number value.
DATE - DAYS The DATE - DAYS operator subtracts the specified number of days from a date value and returns a new date value.
DATE - MONTHS The DATE - MONTHS operator subtracts the specified number of months from a date value and returns a new date value.
DATE - YEARS The DATE - YEARS operator subtracts the specified number of years from a date value and returns a new date value.
DATE + DAYS The DATE + DAYS operator adds the specified number of days to a date value and returns a new date value.
DATE + MONTHS The DATE + MONTHS operator adds the specified number of months to a date value and returns a new date value.
DATE + YEARS The DATE + YEARS operator  adds the specified number of years to a date value and returns a new date value.

Logical Operators

The logical operators compare one value against another and return a true/false value.

Operator What it Does
NOT TRUE_FALSE The NOT TRUE_FALSE operator checks if a true/false value return is false.
TRUE_FALSE AND TRUE_FALSE The TRUE_FALSE AND TRUE_FALSE operator returns a value of true if both of the selected true/false values are true.
TRUE_FALSE OR TRUE_FALSE The TRUE_FALSE OR TRUE_FALSE operator returns a value of true if one or both of the selected true/false values are true.
TRUE_FALSE = TRUE_FALSE The TRUE_FALSE = TRUE_FALSE operator returns a value of true if both of the selected true/false values are true or both are false.
TRUE_FALSE != TRUE_FALSE The TRUE_FALSE != TRUE_FALSE operator returns a value of true if one of the selected true/false values is true and the other is false.
TEXT = TEXT The TEXT = TEXT operator returns a value of true if the two selected text values contain the same amount of characters.
MULT_CHOICE = TEXT The MULT_CHOICE = TEXT operator returns a value of true if the option the end-user selects matches the specified text value.
TEXT != TEXT The TEXT != TEXT operator returns a value of true if the two selected text values do not contain the same amount of characters.
MULT_CHOICE != TEXT The MULT_CHOICE != TEXT operator returns a value of true if the option the end-user selects does not match the specified text value.
TEXT STARTS WITH TEXT The TEXT STARTS WITH TEXT operator checks whether the first text value begins with the second text value and, if it does, returns a value of true.
TEXT CONTAINS TEXT The TEXT CONTAINS TEXT operator checks whether the first text value contains the second text value and, if it does, returns a value of true.
TEXT ENDS WITH TEXT The TEXT ENDS WITH TEXT operator checks whether the first text value ends with the second text value and, if it does, returns a value of true.
TEXT < TEXT The TEXT < TEXT operator returns a value of true if the first text value has fewer characters than the second text value.
TEXT <= TEXT The TEXT <= TEXT operator returns a value of true if the first text value has fewer or the same amount of characters as the second text value.
TEXT > TEXT The TEXT > TEXT operator returns a value of true if the first text value has more characters than the second text value.
TEXT >= TEXT The TEXT >= TEXT operator returns a value of true if the first text value has more or the same amount of characters as the second text value.
NUM = NUM The NUM = NUM operator returns a value of true if the two selected number values are equal.
NUM != NUM The NUM != NUM operator returns a value of true if the two selected number values are not equal.
NUM < NUM The NUM < NUM operator returns a value of true if the first number value is less than the second number value.
NUM <= NUM The NUM <= NUM operator returns a value of true if the first number value is less than or equal to the second number value.
NUM > NUM The NUM > NUM operator returns a value of true if the first number value is greater than the second number value.
NUM >= NUM The NUM >= NUM operator returns a value of true if the first number value is greater than or equal to the second number value.
DATE = DATE The DATE = DATE operator returns a value of true if the two selected date values are equal.
DATE != DATE The DATE != DATE operator returns a value of true if the two selected date values are not the same.
DATE < DATE The DATE < DATE operator returns a value of true if the first date value is earlier than the second date value.
DATE <= DATE The DATE <= DATE operator returns a value of true if the first date value is earlier than or the same as the second date value.
DATE > DATE The DATE > DATE operator returns a value of true if the first date value is later than the second date value.
DATE >= DATE The DATE >= DATE operator returns a value of true if the first date value is later than or the same as the second date value.

Mathematical Functions and Operators

The mathematical functions and operators tell HotDocs to complete common mathematical operations and return the result.

Function/Operator What it Does
ABSOLUTE VALUE The ABSOLUTE VALUE function returns the absolute value (the number without regard to whether it is negative or positive) of the selected number value.
CEILING The CEILING function returns the smallest integer that isn't smaller than the selected number value.
EXPONENTIAL The EXPONENTIAL function uses the selected number value as the exponent of e (roughly 2.71828) to calculate exponential growth.
FLOOR The FLOOR function returns the largest integer that isn't larger than the selected number value.
LOGARITHM The LOGARITHM function finds the common logarithm (the exponent of 10 needed to return the selected number value) of a selected number value.
MAX The MAX function compares two selected number values and returns the greater of the two.
MIN The MIN function compares two selected number values and returns the lesser of the two.
NATURAL LOGARITHM The NATURAL LOGARITHM function finds the natural logarithm (the exponent of e (roughly 2.71828) needed to return the selected number value) of a selected number value.
POWER The POWER function returns the result of the first number value to the power of the second number value.
REMAINDER The REMAINDER function divides the first number value by the second number value and returns the remainder.
ROUND The ROUND function rounds a number value to the specified number of decimal places.
SQUARE ROOT The SQUARE ROOT function returns the square root of a specified number value.
TRUNCATE The TRUNCATE function cuts off a number value after the specified number of decimal points without rounding.
NUM - NUM The NUM - NUM operator subtracts the second number value from the first and returns the result.
NUM * NUM The NUM * NUM operator multiples the first number value by the second and returns the result.
NUM / NUM The NUM / NUM operator divides the first number value by the second and returns the result.
NUM + NUM The NUM + NUM operator adds together the two selected number values and returns the result.

Financial Functions

The financial functions calculate savings, loans and investment values. To find out the value of one, you need to know the value of the other four.

 Function What it Does
FUTURE VALUE The FUTURE VALUE function returns the final amount with interest.
PAYMENT The PAYMENT function returns how much money needs to be paid in each payment period to reach the future value at the end of the term.
PRESENT VALUE The PRESENT VALUE function returns how much the investment is currently worth (i.e. how much money you would need to invest over the same amount of payment periods to equal the return).
RATE The RATE function returns the interest rate per payment period.
TERM The TERM function returns how many payment periods are required to reach the future value.