Repeating sections and pages can be driven by a data source question. And it can only be done by a multiple row data source. If there are 10 rows in the data source then repeating section will show 10 rows. Using "Data with Add and Remove" property, Data-driven sections and pages can have their rows modified.
You can also have questions under your repeat that reference the data source question and they will get the appropriate value for that row. For example, a text field default value references the data source answer. For each row in the repeat, the default value becomes the value from the same row in the data source.
Design: New option on repeating sections and pages to choose how the rows are constructed "Driven By". The options are "Manual", "Data" and "Data with add and remove".
Step 1: Create a Data Source question.
Step 2: Set the selection type as Multiple Rows and configure the question appropriately (Only enabled for multiple row Data Source question
Step 3: Insert a Section and Column. In the Section properties select Repeating. Additional options will pop up.
Just having Repeating selected, it repeats the set of questions that exist in the repeating section as many times as the end user needs and you also get the option to enter max and min rows. Refer to Article Repeating Sections
When "Data Driven" is selected the Max, Min and Show controls are hidden and a new drop-down is shown that displays multi-select data source questions that come before the repeat item.Selecting a data source question from the drop-down will now connect the Repeating Section to that Data Source. Repeat rows will be created as soon as the project is launched.
If a data source changes the number of rows it has, those rows will be added or deleted from the end of the repeat. If a data row is deselected the same row in the repeat will be removed preserving all other rows.
When child questions of the repeat reference the data question, they will only get a single data value from the same row that the child question is in. When a question outside of the repeat references the data question the result will be all of the selected values as before.
The single value mode is enabled for question references in text and defaults, conditions, filters, and rules.
Data when this option is selected, the number of rows in the Repeating Section will be same as the number of rows in the Data Source and any references in the Repeating Section to the Data Source will be calculated on a per-row basis.
In Produce, Repeating section set to "Data" will not display the Add, Delete, Fill Down or Import buttons. For repeat pages the Add and Delete buttons do not display. As Row creation is purely based on Data Source, as a result data-driven sections and pages cannot have their rows modified. Only by changing the data source's selections rows will be modified.
When Data source initially starts with zero rows, the data-driven repeating page might show a blank page.
When Allow Add and Remove selected, Data-driven sections and pages can have their rows modified. This option can be used when the data source is hidden or if you want to add additional rows to the list.
In Produce, Repeating Section set to "Data Driven" and "Allow Add and Remove" will display Add, Delete, Fill Down and import buttons. For repeat pages the Add and Delete buttons will also display.
When you add a manual row using Add button, the question references to the data source question will return a blank string for manually added rows. It is common for questions under the repeat to have data references to show the user what is in the database. When you add a section row manually it is not tied to a data source row and so those references cannot be resolved for manually added rows.
Also note, that modifying the data source's selection will bring back previously deleted section rows. This is essentially a resync of the section rows to the data sources selections. Manually added rows will be untouched.
Step 4: after selecting Driven by option, create a Label (or a Text Field) and refer them to an answer in the Data Source question.
Step 5: Save changes and run your project in Produce.
Updated over 2 years ago