Create a REPEAT Instruction Using a Computation Variable

Instead of inserting a REPEAT instruction directly in a template to generate a list of answers, you can use a REPEAT instruction in a Computation variable to create your list of answers. Using a computation enables you to quickly insert a list in more than one location in the template.

A drawback to this approach is that HotDocs applies punctuating, sorting, and filtering wherever you insert the computation—the list appears exactly the same even in different parts of your assembled document. For example, you would be unable to a display a list of cities in a column at the beginning of the template and then as a punctuated sentence later on.

To use a REPEAT instruction in a computation

  1. At the template, create a Computation variable.
  2. In the Script field, type either empty quotation marks ( "" ) or a zero (0) as the starting value for the computation.

When you use a script to merge a list of answers you have gathered using a REPEAT, you must first set the computation to a starting value. You must make this value a "" which represents “nothing” if  the RESULT expression resolves to text, or a zero (0) if the RESULT expression resolves to a number.)

  1. Type a REPEAT instruction, followed by the dialog name.
  1. Type the RESULT expression, followed by the names of the variables whose answers you want to merge. Use the plus ( + ) operator to add variables, text and space characters (including a hard return), and so forth, to what you want to repeat.
  2. Type an END REPEAT instruction. An example of a possible script would be:

""

REPEAT Tour Information

RESULT + Name of City + ", " + Venue + "

"

END REPEAT