Skip to main content »

Getting the Most out of HotDocs: Number 2


Using COUNT to make sure that the correct plurals are in a document

When you are creating a template which includes a repeated dialog, you often don’t know whether the user will end up adding one or multiple instances to the final document. This makes it hard to know whether the text surrounding the list should be talking about singular or plural.

For example, say you are creating the template for a will and you need make a list of any children the client has. You can use a repeated dialog to allow them to add as many names as necessary but now the rest of the language in your template may need altered depending on where there are one or more children. For example, you could be using “the child is entitled to…” for one child or “the children are entitled to…” for multiple. To avoid having to make this change manually, you can use a little bit of HotDocs scripting to create a computation that inserts the correct version each time.

Using the expressionCOUNTallows HotDocs to calculate how many children there are by counting the number of times the user answered the repeated dialog in the interview. You can put this into a small computation that tells HotDocs that if the repeated dialog is answered more than once to insert the text “children are” otherwise to insert “child is”. Replace all instances of “child is” in the text with that computation and now you won’t have to worry about correcting singular or plural text again.

Here’s the basic method for this example:

1. Create a new Computation and type in the following script:



"children are"


"child is"


(In this example ClientChildren is the name of the repeated dialog used to gather information about any children.)

2. In the template, replace any instance of “child is” or “children are” with the computation.

If that script seems complicated, try speaking it out loud “If count ClientChildren is greater than one “children are” else “child is” end if”. That’s a condensed version of how you might say it to a person: “You’re creating some text. If you count more than one ClientChildren, write “children are”, otherwise write “child is. That’s it.” The double quotations ( "" ) at the beginning of the script are doing just that, informing HotDocs that you want it to output some text, and the “ENDIF” at the end is telling it that you have stated all the allowed options.

Now that you have the basic structure of using a computation like this to insert variations of text you could use it for any number of applications that require a plural.

Share this article