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: 

  1. Define the number of loops manually
  2. Define the number of loops from another field input
  3. 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

    1. Navigate to the Loop tab in the Edit window. 
    2. Select the last Element you want to include in the Loop in the Element to end loop field.
    3. Click Save.

  2. 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 loop box will be included in the loop. 



Important: You must not additionally embed subsections within a loop, as the elements you wish to embed in a subsection have already been embedded in the loop element.



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.


Number

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.




Field Value

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:

  1. If neither the Next Button Label and the Item Label (Static label for repetitions) are defined then the Next Button will read: "Next item"
  2. 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
  3. 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.