Documate is now Gavel! Read more about why we’re excited about this rebrand.

Repeating Items Within Text

All of these options can be easily inserted using the Word add-in without learning code:

Intersperse with Other Text (Instead of a List or Table)

Repeating Question attributes can be used with other text, like this:

Here are the children's names:

{% for item in children %} {{ item.firstname }}, {% endfor %}

Adding Commas & "and" in a List of Repeating Items (e.g., Jack, Jane and Jill)

If you want to write out your list of items and separate them out with commas and an "and," here is the syntax.  Only the ItemName and ItemAttribute will change based on your variables:

Comma

{{ commalist(itemname, '<itemattribute>') }}

Example: Jane, Jack and Jill

Oxford Comma

{{ commalistoxford(itemname, '<itemattribute>') }}

Ex.: Jane, Jack, and Jill

Semicolon

{{ semicolonlist(itemname, '<itemattribute>') }}

Ex.: Jane; Jack; and Jill

Other Separator (useful for other languages)

{{ customseparatorlist(itemname, '<itemattribute>', ‘separator’, ‘finalseparator’) }}

Example:

{{ customseparatorlist(children, '<childname>', ‘,’, ‘y’) }}

Gives us: Jane, Jack y Jill  

Example with multiple attributes

Here is an example where we have both childname, additional text, and the child's date of birth listed in between "and" statements.  Make sure all your attributes go within the ' ', or just use our Word add-in to do this all for you!

{{ commalist(children, '<childname> born on <childdob>') }}

Jane born on 1/1/91, Jack born on 1/1/90 and Jill born on 1/1/89

If for some reason you can't use the List Comma option above (which is also in the Word add-in) you can also use this syntax to add an "and" before the last option.

{% for item in ItemName %}{% if not loop.last and not loop.first %}, {% elif loop.last and not loop.first %} and {% endif %}{{ item.ItemAttribute }}{% endfor %}.

Special Case: Capitalizing Only a Single Attribute of the Repeating Item

Upper Case: If you want to capitalize (all caps) any attribute of the list, you can do so by adding .upper() like this:

{{ commalist(ItemName, "<ItemAttribute> <ItemAttribute2.upper()>") }}