Available in: Axsy Mobile for Salesforce, Axsy Field Service, Axsy Public Sector, Axsy Retail Execution

Axsy Smart Forms allows users to reference Elements from a specific Loop iteration by using indexes. Input can often be repetitive or unique, and so targeting a specific iteration means an easier way to access information to replicate it or capture it.

For more information on Loop Elements and their functionality, please see this article: Configuring Loops

Here are four possible scenarios for Loop indexing and referencing an iteration of a Loop Element:

  1. Reference a specific loop iteration with a number
  2. Default behaviour when no index is provided within the same Loop
  3. Using __INDEX to reference the same loop iteration from another loop
  4. Invalid loop indexes

Index Referencing Syntax

Square brackets are used to specify a specific loop iteration for an Element. 

Example: ElementName[2] will reference the value entered on the second loop iteration of 'ElementName'.

Reference a Specific Loop Iteration with an Index Number

As loops can have multiple iterations, an index number should be provided when referencing an element inside a Loop to indicate from which loop iteration the Element's value should be captured. 

NOTE: If the Element doing the referencing is outside of the Loop that contains the referenced Element, then you always need to provide an index with the referenced Element. If the Element doing the referencing is contained inside the same Loop of the referenced Element, this is optional.

For example, ElementName[1] will refer to that Element's value in its 1st loop iteration.

ElementName[4] will refer to its value for the 4th iteration.

Default Behaviour When No Index is Provided

You can omit an index when referencing another Element within the same Loop. When this is done, the index will match the current iteration that is being executed. 


  1. Manufacturer Number and Serial Number are in the same Loop and a formula used by the Element Serial Number references the Element Manufacturer Number without providing an index (i.e. by referencing Manufacturer Number without any square brackets).
  2. The formula used is the following validation formula: Serial Number != Manufacturer Number.
  3. As a result, whichever Loop iteration Serial Number is on, will be the iteration used to evaluate Manufacturer Number.

Example: On the fourth iteration, the formula Serial_Number != Manufacturer_Number is essentially equivalent to Serial_Number[4] != Manufacturer_Number[4].

Using __INDEX to Reference the Same Loop Iteration from Another Loop

__INDEX is a special tag that evaluates to a Loop's current iteration number. In a similar way to how using no index within a Loop means that the index defaults to the current Loop iteration, using __INDEX allows you to do this with a subsequent, differnt Loop. This is useful for copying values from one Loop to a second Loop later on in the Smart Form by using the formula syntax ElementName[__INDEX].


As an example, Loop Aisle 2 may have the same products as Loop Aisle 1. To copy over the values of the ManufacturerNumberA Element in the Loop for Aisle 1, to the similar ManufacturerNumberB Element in the Loop for Aisle 2 – so they match for every iteration – it uses the formula ManufactuerNumberA[__INDEX] as the default formula for the element ManufacturerNumberB.

Example: When the first loop iteration runs for the Aisle 2 Loop, the value of [__INDEX] will be 1 and the formula ManufacturerNumberA[__INDEX] will then evaluate to ManufacturerNumberA[1]. When the second loop iteration runs, the value of [__INDEX] will be 2 and the formula ManufacturerNumberA[__INDEX] will then evaluate to ManufacturerNumberA[2], and so on.

Invalid Loop Indexes

Whenever you provide an index that is invalid, e.g. ElementName[4] when a Loop is only set to run 3 times, it will result in a blank value.