Literals

A literal is a representation (in the HotDocs scripting language), of a specific known value; this means the literal has a certain syntax for conveying that value. For example, when you are creating a script and you want to reference a record literal, you enclose the items in a record literal in curly braces and separate the values in the record by commas, like this:

In this topic Hide

  1. Common Tasks
  2. Types of Literals in the HotDocs Scripting Language
  3. Important General Considerations when Working with Literals
  4. Important Considerations when Working with Text Literals

Common Tasks

Among others, literals enable you to perform the following common tasks:

Types of Literals in the HotDocs Scripting Language

Every value type in the HotDocs scripting language has a corresponding literal notation that enables you to work with that type and access its value in a scripting context.

Type of Literal Syntax
Text literals Text literal values are strings within quotes, like this:
"This is a text literal."
Number literals Number literal values are simply integers, as follows:
7

In addition:

  • Numbers cannot contain commas (1250 not 1,250)
  • Decimal numbers less than one must have a zero before the decimal point (0.125 not .125)
Date literals Date literal values require a day, month, year order, (abbreviating the month) as follows:
11 FEB 1964
True/False literals True/False literal values appear as:
TRUE or FALSE

Important General Considerations when Working with Literals

When using literal values in 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:

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.

Important Considerations when Working with Text Literals

When you are using text literals, besides the basic rules described in the table above, there are some other important considerations: