Loops will iterate over a set of elements/element for a number of times. To configure the maximum number of times a loop can run you have three options: define the number of loops manually, define the number of loops from another field input, or configure it based on the Mapping tab.
Before you configure the maximum number of loops you want your Loop Element to iterate, you need to give the loop an end point after which the loop will run again.
Edit a Loop Element
1. Make sure your Loop Element is directly above the first element you want to be part of the loop and edit the Loop Element. For more on editing Elements, please see here: How to Edit Elements - General
- Navigate to the Loop tab in the Edit window.
- Select the last Element you want to include in the Loop in the Element to end loop field.
- Click Save.
2. Your loop should look something like this on the Section Elements Manager:
Here, the loop will begin on the Address Element and end on the Date Element. Every element with part of the orange line next to it will be included in the loop.
Set the Maximum Number of Loops
Now you have defined the parameters for your Loop Element, you now need to define the maximum number of times you want the loop to iterate.
The first way is to set MaxAllowed to a number manually. Navigate back to the Edit window of your Loop Element and enter a number of loops.
If the maximum number of loops is not defined or is set to 0, this allows for an infinite number of loops.
The next way is to set maxAllowed number of loops to a field value – this will capture a number input from an element field before the Loop Element. Search for and select the field value that has a numeric input.
Mapping Results Number
Lastly, you can set the maxAllowed number of loops to the number of results produced from a mapping configuration.
Define the Next Label
Optionally, you can also define what appears as the button label that is selected to navigate to the next loop iteration. Enter a value into the Next Button Label field.
Save your changes.
- For more information on how to get started with a mapping, please see this article: How to use Smart Form Mapping - Create a Mapping Set
- For more information on how to define the data for a mapping, please see this article: How to use Smart Form Mapping - Create a Data Mapping