Create a List Within a List

Sometimes you may need to gather a list of answers that must appear within a larger list of answers. For example, perhaps you need a list of your client's real estate holdings. For each holding, you also need property descriptions and improvements. You can create these lists by nesting one REPEAT instruction inside another.

There are two parts to creating a list within a list:

  • First, you must select all the template text you want repeated and insert the required REPEAT instruction fields.
  • Second, you must edit the properties of the parent (or main) dialog and insert the nested dialog(s) into it.

The first step in creating a list within a list is to REPEAT each level of text in the template. (See Create a REPEAT Instruction to Gather a List of Answers.)

To create a nested repeat

  1. Create the variables you want repeated and insert them into the template. (See Insert a Variable Field in a Text Template.)
  2. Gather the variables you want repeated into dialogs. (Make sure you choose a repeat style for each dialog. See Gather Questions into a Custom Dialog.)
  3. At the template, select all the template text and variables you want repeated (including all repeat levels) and click the REPEAT Field button. The REPEAT Field dialog box appears.
  4. Select the dialog for the first (or top) level of the repeat from the Dialog drop-down list and click OK. HotDocs inserts the REPEAT instruction in the template. (Even though you have selected all levels of the repeat in the template text, this dialog should only contain the variables from the first level of the repeat.)
  5. At the template, select the second level of repeated text and variables, as well as any subsequent levels of information (do not select the END REPEAT instruction) and click the REPEAT Field button. The REPEAT Field dialog box appears again.
  6. Select the dialog for the second level of the repeat from the Dialog drop-down list and click OK.
  7. Repeat this process for each subsequent list.

The second part in nesting REPEAT instructions is to edit the contents of each dialog and insert each repeated dialog (except the dialog for the first repeat level) into the preceding level’s dialog.

  1. Edit the dialog in the first (or top) level of the repeat. (See Edit a Custom Dialog.) The Dialog Editor appears.
  2. Drag the dialog for the second repeat level from the Available Components list into the Contents field and click OK.
  3. Repeat this process until each dialog in the nested repeat (except for the first) is inserted into the preceding level’s dialog.

Repeats can not be nested more than four levels deep.

By default, a child dialog appears as a button on the parent dialog. You can change the style of a repeated dialog to Spreadsheet on parent, which lets users enter the nested list of answers while viewing its parent dialog. (See Display a Child Dialog Directly on the Parent Dialog.)

If you are nesting REPEAT instructions in a form template, the REPEAT instructions must be placed in a Computation variable. See Nest REPEAT Instructions Using a Computation Variable for details.