END REPEAT Instruction

The END REPEAT instruction designates the end of a repeated region.

The REPEAT instruction is only available when you are creating a computation or from the Field Editor in a template.

An END REPEAT instruction tells HotDocs where the repeated region finishes so it only processes the area between the REPEAT and END REPEAT instructions for every iteration.

You must use an END REPEAT instruction after a REPEAT instruction to close the repeated region.

Instruction name Model After you drag and drop the model into the script tab:
END REPEAT END REPEAT You don't need to do anything further with this model.

Example

A REPEAT instruction gathers lists of answers and places them into a document.

For example, the following script gathers a list of editors and inserts them into the assembled document:

«REPEAT Editor Information»

Editor: «Editor First Name» «Editor Last Name»

«END REPEAT»

Each REPEAT instruction must also include an END REPEAT instruction, which tells HotDocs to stop repeating the variables within the instruction.

This next computation script actually contains two repeated dialogs—one nested in another. It produces a list of editors as well as the titles and authors he or she 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

You can create up to three levels of sublists by nesting REPEAT instructions. (See Introduction: Create Lists Within a List.)

For more information about creating lists of answers, see Introduction: Include Lists in Your Documents.

Repeats can not be nested more than four levels deep.

While editing complicated sequences, you can jump from the END REPEAT instruction to its associated REPEAT instruction, or vice versa, by placing the cursor within the REPEAT or END REPEAT chevrons, then clicking the Match Fields button.

Download

After you download the example template, you can import the template to any workspace to see this example code in action.