INDEX
Use the INDEX function to return an item from an Array at the specified position.
Use
INDEX( array, position )
Returns an item from an array at the position given.
| Parameter | Required | Description |
|---|---|---|
| array | Yes | any array |
| index | Yes | the position of the item to return (starting at 1) |
| Returns | An item from the array matching the type of array |
Examples
Conditional Activity Assignment
In an approval workflow, a trigger form might capture an array of potential participants, such as a list of "Requested Approvers". If your logic requires assigning a task specifically to the second person listed in that array, you can use INDEX in an Activity Assignment Formula.
- Formula:
INDEX(@Trigger.out.RequestedApprovers, 2). - Logic: The function scans the array provided by the trigger and returns the identity of the person at the second position. This result ensures the activity is assigned to that specific individual rather than the whole group.
Variable Update for Specific Data Retrieval
You can use INDEX within a Variable Update Formula to pull a specific value from a multi-valued variable (array) for further calculation, display, or status tracking.
- Scenario: A variable named
$ProjectMilestonesstores a Text Array of four goals. You want to update a separate variable,$CurrentTarget, with the third goal in that list. - Formula:
INDEX($ProjectMilestones, 3). - Logic: This formula targets the third item in the
$ProjectMilestonesarray. The result of this formula then replaces the old value of$CurrentTargetwith the specific text found at that position.