Repeatable Data in Templates

Repeatable Data in Templates

After capturing repeatable data, you might want to customize how it displays in a PDF output using Word or Excel templates.

There are two ways to output the answers for these repeatable fields in your template:

  1. Repeat rows in a Word table or Excel worksheet using the special {{REPEATROW}} placeholder
  2. Define the section of the template to output for each repeat.
    This uses the special {{!REPEATSTART}} and {{!REPEATEND}} placeholders.

These options allow you to handle repeating data the way you want.

While there are many flexible ways to handle repeating data, please note that nesting REPEATSTART/REPEATEND syntax is not supported — that is, you cannot place a REPEATSTART inside another REPEATSTART.

If you need to hide content dynamically, the correct approach is to use Hiding Sections/Rows in Custom Templates.

For downloadable examples of repeatable data templates, jump to the end of this article.

Repeating Rows

Often, it is helpful to place repeating data in a Word table or Excel worksheet.

You can create a repeatable listing by adding a special {{!REPEATROW}} placeholder into the first cell of the row you want to repeat.

The system will then repeat the enclosing row and replace all placeholders within the relevant data values, for example:

Word – Table

First NameLast NameGender
{{!REPEATROW}}{{firstname}}{{lastname}}{{gender}}

Excel – Sheet

First NameLast NameGender
{{!REPEATROW}}{{firstname}}{{lastname}}{{gender}}

Remember that you must place the {{!REPEATROW}} placeholder as the very first item in the row!

Multiple Repeats per Row

It may be helpful to show repeat values side by side in the same row – for example, if you have a repeating photo capture page, you might want to put the photos side by side in a two or three-column configuration.

This is possible by adding some special syntax to the {{!REPEATROW}} placeholder: You must put a pipe character followed by the number of repeats to handle per row.

So, for example, if you want to have three sets of repeated values side by side, then you would use the following:

Repeat Syntax Example
{{!REPEATROW|3}}

Then in the repeated row part of your template, you must specify the desired repeat fields as many times as the number of sets to display.

When generated, the answer value from each repeat will be inserted sequentially for each occurrence of the same dataname in the row, for example:

Word – Table

{{!REPEATROW|3}}{{photo}}

{{photo}}

{{photo}}

Excel – Sheet

{{!REPEATROW|3}}

{{photo}}

{{photo}}

{{photo}}

Repeating Sections

With this option, you define the placeholders once for the desired fields in a repeatable page group and enclose these within unique {{!REPEATSTART}} and {{!REPEATEND}} placeholders.

The system will repeat all rows between the START and END placeholders for Excel.

 This tells the system to repeat everything found within the REPEAT placeholders, including formatting, bullet points, table rows, images, static text, etc.

When generating output, the system copies the area within the REPEATs and replaces all regular data name placeholders within the area for each repeat of the answers.

For example, imagine we have a Form with a repeatable set of fields for capturing children:

  • First Name (data name=”firstname”)
  • Last Name (data name=”lastname”)
  • Gender (data name=”gender”)

You could define a repeatable bullet listing as follows:

Repeat Syntax Example
{{!REPEATSTART}}
Name: {{lastname}}, {{firstname}}
Gender: {{gender}}
{{!REPEATEND}}

Both {{!REPEATSTART}} and {{!REPEATEND}} placeholders must exist on their own rows, respectively.

Repeating Sections – JSON

Output JSON-formatted text through a JSON template using the syntax below to iterate through repeating sections of data:

JSON Example
"Activities": [
{
"FormId": "",
"FormExternalId": "test",
"FormAnswers": [
{
"Name": "page1",
"Type": "Group",
"Answers": [
{
"Name": "choice",
"Value": "{{choice}}"
},
{{!REPEATSTART}}
{
"Name": "table",
"Type": "RepeatGroup",
"Answers":
[
{
"Name": "company",
"Value": "{{company}}"
},
{
"Name": "job",
"Value": "{{job}}"
}
]
},
{{!REPEATEND}}
]
}
]
}
],

This syntax can be used when outputting data for a JSON template or when communicating with JSON REST APIs. The syntax is the same.

Repeating Sections – XML

Output XML-formatted text through an XML template using the syntax below to iterate through repeating sections of data:

XML Example
{{!REPEATSTART}}
{{the_artist}}
{{country}}
{{company}}
{{price}}
{{year}}
{{!REPEATEND}}

Multiple Repeats per Section

At times, it may be useful to show repeat values side by side in the same section. For example, if you have a repeating photo capture page, you might want to put the photos side by side in a two—or three-column configuration, with accompanying captions and other repeated data shown above or underneath each photo.

This is possible by adding some special syntax to the {{!REPEATSTART}} placeholder: You must put a pipe character followed by the number of repeats to handle per row.

So, for example, if you want to have three sets of repeated values side by side, then you would use the following:

Repeat Syntax Example
{{!REPEATSTART|3}}

Then, in the repeated section part of your template, you must specify the desired repeat fields as many times as the number of sets to display.

When generated, the answer value from each repeat will be inserted sequentially for each occurrence of the same dataname in the section, for example:

Word – Page & Table

Photos

{{!REPEATSTART|3}}

Photo Name:{{photoName}}Photo Name: {{photoName}}Photo Name: {{photoName}}
{{photo}}{{photo}}{{photo}}
{{photoCaption}}{{photoCaption}}{{photoCaption}}

{{!REPEATEND}}

Excel – Sheet

{{REPEATSTART|3}}  
Photo Name:{{photoName}}Photo Name:{{photoName}}Photo Name:{{photoName}}
{{photo}}{{photo}}{{photo}}
{{photoName}}{{photoName}}{{photoName}}
{{REPEATEND}}  

Examples

Attached are a form design and data output templates for Word and Excel to help you understand how the above functionality works.

  1. Download these attachments, then create a new form for your account.
  2. Go to the Designer page of your new Form, and use the “Import Fields” button to import the Form .xlsx file.
    This will import the testing form design. After importing the fields, you should set the Form to Test mode.
  3. Then go to the Settings page of your new Form, and upload the attached Template .xlsx and docx files into the Excel and Word Default Template fields, respectively.
  4. Now open the Form on your device and capture an entry. When prompted, make sure you capture more than one photo.
    Complete the entry and upload it from your app.
  5. Finally, go to the Data page of the secure website and find your entry.
    Mouse over the entry row and click the Export link. Then, choose one of the Template files to download the output.
    • Related Articles

    • Nesting Repeatable Data

      Capturing structured, repeatable data is essential for many workflows, from property audits to equipment inspections. However, some scenarios require additional repetition, such as rooms within apartments or components within a machine. The most ...
    • Capturing Repeatable Data

      There are 3 field types that enable you to capture data on a repeating basis: the Page field, the Table field and the Gallery field. You can use any of these 3 repeatable field types to enable your users to capture multiple data entries. Please note ...
    • Nesting Repeatable Data - Nested Repeating Tables

      Capturing repeatable data using a repeating Table field is amazing, However, sometimes, you need to group data within other data, like putting a smaller box inside a bigger box. In the app builder, you can do this by nesting one Table Field inside ...
    • Text Templates (Text, CSV, JSON, XML)

      You’re probably already familiar with our platform’s ability to produce custom PDF reports from Word or Excel templates using our Data Template Syntax. However, you can also produce file outputs like Plain Text, CSV, JSON, and XML. Form Connectors ...
    • Capturing Repeatable Data

      Three field types enable you to capture data repeatedly—the Page, Table, and Gallery fields. You can use either of these 3 repeatable field types to enable your users to capture multiple data entries. Identifying how you want to capture multiple sets ...