REPEAT Instruction
A REPEAT instruction tells HotDocs to process each repetition of the repeat dialog you specify. The REPEAT Enables you to specify a repeated dialog for gathering a list of answers from your template user and instructs HotDocs to build a list into your assembled document. You add the REPEAT instruction to an instruction field in your template when you create a repeated region. You can also add a REPEAT to a computation.
You must use an END REPEAT instruction after a REPEAT instruction to close the repeated region.
Repeat Instruction Model (for Computations)
Instruction name | Model | After you drag and drop the model into the script tab: |
REPEAT | REPEAT ⟦DIALOG⟧ | Replace ⟦DIALOG⟧ with the repeated dialog you want to use in the interview to gather multiple answers from your template users. |
Nested Repeats
If you want to create sub-lists within your main list you can nest REPEAT instructions (up to four levels deep) by placing one REPEAT instruction inside another. For example, you might use a REPEAT instruction to create a list of a client's children and then for each child you might use another REPEAT instruction to create a list of their children.
Modify Your List Outputs
When you add a repeated region to a template using the Field Editor, you can modify the list using the Field Editor's Advanced Properties. In a computation you can use the ASCEND, DESCEND, FILTER, and FORMAT instructions.
Examples
The following examples gather a list of book editors from your template users during an interview; then add the list into the assembled document.
Instruction Field Example
The first is a simple instruction field you add using the Field Editor. This example references a dialog you would create called Editor Information that contains two Text variables: EditorFirstName and EditorLastName. To create your repeated region, in your template, you would select Editor: [Editor First Name] [Editor Last Name]and then in the Field Editor, click Create a Repeated Region. This results in the following:
[REPEAT Editor Information]
Editor: [Editor First Name] [Editor Last Name]
[END REPEAT]
Computation Example
The computation script below references two repeated dialogs – one nested in the other (BookInformation is nested within EditorInformation). This not only produces a list of editors – it also gathers a list of the titles and authors each editor is currently working with:
""
REPEAT Editor Information
RESULT + "Editor: " + Editor First Name + " " + Editor Last Name + "
"
REPEAT Book Information
RESULT + "Book Title : " + Book Title + "
" + "Author: " + Author First Name + " " + Author Last Name + "
"
END REPEAT
END REPEAT