Repeats in a Word Processor Table Overview

You can insert a list of answersData users enter during an interview. Answers are usually merged into the document, but sometimes they are used to calculate other answers that are used in the document. See also answer file. into a word processor table using a REPEAT instructionAn instruction that repeatedly asks the same variable(s) so that users can provide two or more answers for a given question. REPEAT instructions are used to create lists of answers in the document.. Then, as the user provides answers during the interviewA series of dialogs, each containing one or more questions which HotDocs generates from the variables you add to your template. The template's user must answer the questions in the interview before HotDocs can assemble a custom document. You can view the interview by clicking the Interview tab of the assembly window. The left pane of the assembly window displays an outline of the interview. As the user answers questions, the outline tracks the user's progress through the interview., HotDocs adds that information to the table.

There are two main approaches to inserting a REPEAT instruction into a table:

  • Regular REPEAT—If you want to repeat the contents of a single cell in a table you select only the text within that cell, taking care to not select the cell itself. This causes the repeat to function as a regular REPEAT instruction does when not in a table.

  • Row REPEAT—If you want to repeat an entire row of a table, you need to select an entire cell or the entire row of the table. When you insert a row REPEAT instruction in a table, HotDocs does not include an END REPEAT instruction—the end of the row signifies the end of the repeat.

When you place row REPEAT instructions in a table you should be aware that:

    • Each row in the table must have the same number of columns

    • The REPEAT instruction must be the first HotDocs field in the table row; no other HotDocs field can precede the REPEAT

    • You can repeat only a single row of the table; if you use a row REPEAT field in a table it cannot be followed by another row REPEAT field in the same table

It is possible to use multiple REPEAT instructions of both types within a single table. To do so, ensure that the REPEAT instructions are correctly nested in dialogs, and that you place any regular REPEAT instructions completely within a single cell.

HotDocs supports the following different combinations of REPEAT instructions in a table cell:

  • A regular REPEAT completely contained within a single table cell. In the case of nested regular REPEAT instructions, you must place the outermost regular REPEAT completely within a single table cell.
  • A row REPEAT that is the first field in the table row.
  • A row REPEAT that is the first field in a table row followed by any number of Regular REPEAT instructions, either in the same cell (after the single Row REPEAT) or in other cells of the same row. You must place each Regular REPEAT (and any Regular REPEATS nested inside them) completely within the table cell in which they appear. Additionally, you must make each outermost regular REPEAT a child dialogA dialog that is inserted within another dialog. When it's inserted, it becomes linked to that dialog—users can't answer questions in it without first viewing the parent dialog. Usually the two dialogs are related in content or purpose. of the row REPEAT field at the beginning of the row. Equally you must make nested regular REPEAT instructions child dialogs of their respective containing REPEAT instructions.

Repeats can not be nested more than four levels deep.

In addition to the two main methods for inserting a REPEAT instruction in a table covered above, you can also create REPEAT instructions using a computation variableA type of component that performs calculations or executes other instructions within the template. Computation variable scripts are created using the HotDocs scripting language..

Using REPEAT instructions in a Table in Different Template Types

When you are using REPEAT instructions within word processor tables, it is important that you are aware of the differences which you can expect when using different types of HotDocs templates.

REPEAT instructions in DOCX templates

When you put a repeat in a table, and the interviewee does not provide any answers for the repeated element, the default behavior in RTF or WPT templates is for the assembled document to display the empty row. This differs from a DOCX template, which doesn't display the empty row (if the empty row was the only row in the table, HotDocs removes the entire table from the assembled DOCX document).
If you want to use the same template across multiple formats, and you want the template to behave in a consistent, predictable way regardless of the format, you can surround the entire table in an IF block (this is easiest if you select around the table before you click IF Field) in the following format:
IF COUNT(RptDlg)>0/END
This makes the table conditional in the RTF and WPT formats in the same way that the DOCX table already is on its own. The image below is of an actual RTF template using this format to hide the row in the assembled document.

Due to the differences in how HotDocs assembles a DOCX template or an RTF template, there are often some differences in table formats. For example, if you choose to enclose the whole table in a repeat instruction rather than using REPEATs within the table, HotDocs does not recommend having any text on the same line as the REPEAT instruction preceding a table. In an RTF template HotDocs merges this text into the first cell of the table after assembly. In a DOCX template that text remains visible above the table; however, the table itself has a gap between each row. These issues can be avoided by placing the REPEAT instruction on a line by itself.

REPEAT instructions in WordPerfect templates

The option for inserting a regular REPEAT in a table cell when editing a WordPerfect template is not currently available from the REPEAT field dialog. You must type the code into the template manually.

REPEAT instructions in form templates

HotDocs supports a regular REPEAT within a table cell in text templates (RTF, DOCX, and WPT) only. There is no support for a regular REPEAT in a table cell of a graphical form. Using the REPEAT instruction in a form template only produces row REPEAT instructions. regardless of where you place the REPEAT within the cell.