Use Gavel’s Repeating Item question type to collect variable-length lists, nest repeating items, apply conditionals, and count entries in your documents.
Many legal documents require information about a variable number of people or things: a client’s children, the parties to a contract, a list of assets in an estate, or the shareholders of a company. You never know in advance how many entries there will be — it could be one or twenty. Repeating Items (also called looping lists) are designed exactly for this. A Repeating Item question lets respondents add as many entries as they need, and Gavel loops through all of them to populate your document.
Repeating Item questions must be placed on their own dedicated page. Do not add other question types to the same page as a Repeating Item. Create a new page in the Builder before adding one.
When you add a Repeating Item question, you define:
The item name — a variable name representing the collection (e.g., children, assets, parties)
The attributes — sub-questions for each entry (e.g., FirstName, dob, address)
The respondent adds entries one at a time, answering the attribute questions for each. Gavel collects all entries and stores them as a list. Your document template then loops through that list to output each entry.
To populate a table in your Word document with repeating item data, add the for/endfor tags to the first and last rows of the table respectively, with attribute variables in the middle rows. Gavel will generate a new table row for each entry in the list.
Step 1. Add a “repeating item reference” question to the workflow
Once you have created a repeating item question, create a choice question or a Repeating Item with a choice attribute. (Choice questions can be single-select, multi-select, combobox, or dropdown.)
Select the Reference a repeating item checkbox.
Select the repeating item you’re referencing and up to two attributes to display.
All the data from the repeating item comes with that selection. If you have a repeating item “children,” and a single select question referencing “children,” it will pull all the information about that child you gathered in the repeating item. No need to regather that information!
Because each repeating item may have multiple attributes (e.g., children could have attributes such as first name, last name, date of birth, residence, etc.), you need to reference the appropriate attribute, which varies depending on the question type.
Option 3: Repeating Item question referencing a repeat
{% for item in SecondItem %} {{ item.ItemAttribute.FirstItemAttribute }} {% endfor %}
Example — if the second item is grandchildren and we’re asking who each grandchild belongs to:
{% for item in grandchildren %}{{ item.grandchildname }} is the child of {{ item.grandchildparent.child_first_name }}{% endfor %}
Example where the attribute is a multi-select: If the repeating item referencing the first repeating item is a multi-select, the syntax will be slightly different, since a multi-select is a list of items, too.Use this syntax for a comma list:
{% for item in Item2Name %}{{ commalist(item.Item2Attribute,"<Item1Attribute>") }}{% endfor %}{% for item in grandchildren %}{{ commalist(item.grandchildparent,"<child_first_name>") }}{% endfor %}
Use this syntax for a multi-line list:
{% for item in Item2Name %}{% for selection in item.Item2Attribute %}{{ selection.Item1Attribute }}{% endfor %}{% endfor %}{% for item in grandchildren %}{% for selection in item.grandchildparent %}{{ selection.child_first_name }}{% endfor %}{% endfor %}
Step 1. Add a “repeating item reference” question to the workflow
Once you have created a repeating item question, create a choice question or a Repeating Item with a choice attribute. (Choice questions can be single-select, multi-select, combobox, or dropdown.)
Select the Reference a repeating item checkbox.
Select the repeating item you’re referencing and up to two attributes to display.
All the data from the repeating item comes with that selection. If you have a repeating item “children,” and a single select question referencing “children,” it will pull all the information about that child you gathered in the repeating item. No need to regather that information!
Because each repeating item may have multiple attributes (e.g., children could have attributes such as first name, last name, date of birth, residence, etc.), you need to reference the appropriate attribute, which varies depending on the question type.
Option 3: Repeating Item question referencing a repeat
{% for item in SecondItem %} {{ item.ItemAttribute.FirstItemAttribute }} {% endfor %}
Example — if the second item is grandchildren and we’re asking who each grandchild belongs to:
{% for item in grandchildren %}{{ item.grandchildname }} is the child of {{ item.grandchildparent.child_first_name }}{% endfor %}
Example where the attribute is a multi-select: If the repeating item referencing the first repeating item is a multi-select, the syntax will be slightly different, since a multi-select is a list of items, too.Use this syntax for a comma list:
{% for item in Item2Name %}{{ commalist(item.Item2Attribute,"<Item1Attribute>") }}{% endfor %}{% for item in grandchildren %}{{ commalist(item.grandchildparent,"<child_first_name>") }}{% endfor %}
Use this syntax for a multi-line list:
{% for item in Item2Name %}{% for selection in item.Item2Attribute %}{{ selection.Item1Attribute }}{% endfor %}{% endfor %}{% for item in grandchildren %}{% for selection in item.grandchildparent %}{{ selection.child_first_name }}{% endfor %}{% endfor %}
You can add a Repeating Item inside another Repeating Item to collect data about sub-lists that belong to each entry in the parent list. For example: a list of children (parent repeating item), where each child may have their own list of grandchildren (nested repeating item).
Add a Repeating Item question for the parent list (e.g., children). It must be on its own page.
Add at least one attribute question to the parent Repeating Item.
Click Add another within the Repeating Item editor and choose Repeating Item as the question type.
Give the nested item a name (e.g., grandchildren) and add its attribute questions.
You can optionally ask an initial question (such as “Does this child have any children?”) before the nested entries are collected. This is recommended when the nested list may be empty for some parent entries.
Because nested Repeating Items always display on their own page during the questionnaire, you can customize the page title to show context from the parent entry. Use the syntax:
${ ItemName[i].AttributeName }
Example — show the child’s name when asking about their grandchildren:
{% for item in ItemName %}{% for nesteditem in item.NestedItemName %}{{ nesteditem.NestedAttributeName }}{% endfor %}{% endfor %}
Example:
{% for item in children %}My child {{ item.ChildName }} has the following children:{% for nesteditem in item.grandchildren %}Name: {{ nesteditem.FirstName }}Birthdate: {{ nesteditem.dob }}{% endfor %}{% endfor %}