Outputting Repeatable Data
There are two ways to output the answers for these repeatable fields in your template:
- Repeat rows in a Word table or Excel worksheet using the special
{{!REPEATROW}}
placeholder
- 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.
For downloadable examples of repeatable data templates, jump to the end of this article.
In this article
- Repeating Rows
- Multiple Repeats per Row
- Repeating Sections
- Multiple Repeats per Section
- Word - Page & Table
- Excel - Sheet
- Examples
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 Name | Last Name | Gender |
{{!REPEATROW}}{{firstname}} | {{lastname}} | {{gender}} |
Excel - Sheet
First Name | Last Name | Gender | |
{{!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 useful 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, specifically, 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:
{{!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 (multiple repeats per row)
{{!REPEATROW|3}}{{photo}} | {{photo}} | {{photo}} |
Excel - Sheet (multiple repeats per row)
{{!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.
For Excel. the system will repeat all rows between the START and END placeholders.
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 will copy the area within the REPEATs. It will replace 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:
{{!REPEATSTART}}
Name: {{lastname}}, {{firstname}}
Gender: {{gender}}
{{!REPEATEND}}
Note: 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:
"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}}
]
}
]
}
],
JavaScript
This syntax can be used when outputting data for a JSON template or when communicating with JSON REST APIs. The syntax is the same.
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:
<CATALOG>
<CD>
{{!REPEATSTART}}
<TITLE>{{the_title}}</TITLE>
<ARTIST>{{the_artist}}</ARTIST>
<COUNTRY>{{country}}</COUNTRY>
<COMPANY>{company}}</COMPANY>
<PRICE>{{price}}</PRICE>
<YEAR>{{year}}</YEAR>
{{!REPEATEND}}
</CD>
</CATALOG>
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, specifically, 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:
{{!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 (multiple repeats per section)
Photos
{{!REPEATSTART|3}}
Photo Name:{{photoName}} | Photo Name: {{photoName}} | Photo Name: {{photoName}} |
{{photo}} | {{photo}} | {{photo}} |
{{photoCaption}} | {{photoCaption}} | {{photoCaption}} |
{{!REPEATEND}}
Excel - Sheet (multiple repeats per section)
{{!REPEATSTART|3}} | ||
Photo Name: {{photoName}} | Photo Name: {{photoName}} | Photo Name: {{photoName}} |
{{photo}} | {{photo}} | {{photo}} |
{{photoCaption}} | {{photoCaption}} | {{photoCaption}} |
{{!REPEATEND}} |
Examples
Attached is a form design and data output templates for Word and Excel to help you understand how the above functionality works.
- Download these attachments, then create a new Form in your account.
- 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, and you should set the Form to Test mode after importing the fields.
- 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.
- Now open up the Form on your device and capture an entry. Make sure you capture more than one photo when prompted.
Complete the entry and upload it from your app.
- 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.