Many templates have a need to present repeating data.
Often the precise number of repeated answers will vary from data entry to data entry.
You can add repeatable sets of fields to a Form by using a Page Group with the Repeatable property ticked on.
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 give you the flexibility to handle repeating data the way you want.
For downloadable examples of repeatable data templates, jump to the end of this article.
Using the Repeat Rows Approach
Often it is useful 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 very first cell of the row you want to repeat.
The system will then repeat the enclosing row and will replace all placeholders found within the relevant data values.
For example in a Word table:
FIRST NAME |
LAST NAME |
GENDER |
{{!REPEATROW}}{{firstname}} |
{{lastname}} |
{{gender}} |
An Excel worksheet may look like:
|
LAST NAME |
GENDER |
{{!REPEATROW}} |
{{lastname}} |
{{gender}} |
Remember that you must place the {{!REPEATROW}} placeholder as the very first item in the row!
Advanced Use: Outputting multiple repeats per row
At times 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 2 or 3 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 3 sets of repeated values side by side, then you would use:
{{!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 in a Word table:
{{!REPEATROW|3}}{{photo}} |
{{photo}} |
{{photo}} |
An Excel worksheet may look like:
{{!REPEATROW|3}} |
{{photo}} |
{{photo}} |
{{photo}} |
Using the Repeating Sections Approach
With this option you define the placeholders once for the desired fields in a repeatable page group, and enclose these within special {{!REPEATSTART}} and {{!REPEATEND}} placeholders.
For Excel. the system will repeat all rows found 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 make a copy of the area within the REPEATs and will replace all regular data name placeholders found 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}}
Important Note: Both {{!REPEATSTART}} and {{!REPEATEND}} placeholders must exist on their own rows respectively.
Advanced Use: Outputting 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 2 or 3 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 3 sets of repeated values side by side, then you would use:
{{!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 in a Word document:
Photos
{{!REPEATSTART|3}}
Photo Name: {{photoName}} |
Photo Name: {{photoName}}
|
Photo Name: {{photoName}}
|
{{photo}} |
{{photo}} |
{{photo}} |
{{photoCaption}} |
{{photoCaption}} |
{{photoCaption}} |
{{!REPEATEND}}
An Excel worksheet may look like:
|
||
Photo Name: {{photoName}} |
Photo Name: {{photoName}}
|
Photo Name: {{photoName}}
|
{{photo}} |
{{photo}} |
{{photo}} |
{{photoCaption}} |
{{photoCaption}} |
{{photoCaption}} |
|
Nested Repeats
Unfortunately we don’t currently support nested repeats within the template engine. When nested repeats are required, the best option would be to collapse the sections to be repeated. As an example, assume you have a list of buildings, that contain multiple rooms, and these rooms contain multiple items. You could have a repeating page, or a page within a table where the user can choose a building, then a room, and then an item, from three choice fields in the page. The form could use the PRIOR() formula to set the building and room values dynamically to save a user’s time by carrying forward the values from one page to the following page.
We do have plans to include nested repeats within the template engine, but do not yet have a time-frame for when this feature will be implemented.
Examples of Repeatable Templates
Attached is a testing form design, along with data output templates for Word and Excel that will you help 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 see the output.