getIndexByValue
Use the getIndexByValue function to find the index of the first item in a collection that matches a given value. Text values are compared without regard to case. If no matching item is found, or if the collection or the value is empty, no value will be returned.
Function format
getIndexByValue(Input Collection, Value)
-
Input Collection: The collection that is searched for the value.
-
Value: The value to search for within the collection.
getIndexByValue example
In an Expenses Repeating section, use getIndexByValue to find the first row that has "Travel" as its category. You can then use the returned index with getCollectionItem to look up a related value, such as the Amount in that row.
getIndexByValue(["Travel", "Meals", "Travel", "Supplies"], "Travel")
The formula returns the Integer 0, the row position of the first "Travel" category in an Expenses Repeating section. Collections start at 0.