Available in: Axsy Mobile for Salesforce, Axsy Field Service, Axsy Public Sector, Axsy Retail Execution
Loops will iterate over a set of Element(s) 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
- 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
- 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.
- Your loop should look something like this on the Section Elements Manager:
Example: Here, the loop will begin on the Organization Element and end on the Phone # Element. Every element within the orange box will be included in the loop.
Set the Maximum Number of Loops
Now that 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.
NOTE: 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 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.
The Next Button (as seen in the mobile app) is formatted as follows when the Next Button Label and the Item Label (Static label for repetitions) fields are used:
- If neither the Next Button Label and the Item Label (Static label for repetitions) are defined then the Next Button will read: "Next item"
- If the Next Button Label is defined and the Item Label (Static label for repetitions) not defined, but then the Next Button will read "Next" + Next Button Label
- If the Next Button Label is defined and the Item Label (Static label for repetitions) is defined then the loop Next Button will read: "Next" + Item Label (Static label for repetitions) and the Next Button Label is ignored.
Define Static or Dynamic Labels
Additionally, you can configure either a Static and / or a Dynamic Label. Note if both Static and Dynamic Labels are configured, the Static Label will be shown until the conditions for the Dynamic Label become active.