LASTINDEXOF function

Synopsis
This function returns the index of the last value in the array for which the specified condition is true. If no such value is found, the function returns 0.
Variations
LASTINDEXOF(SourceArray, Condition)
Returns the index of the last value that matches the condition.
Parameters
SourceArray

Specifies the array from which to find the index.

Supported types: Numeric array; Boolean array; String array; Point array; Object array.
Condition

Specifies the condition that an element must satisfy for the function to return its index.

Supported types: Boolean.
Returns
Returned types: Numeric.
Examples
1.

In this example, the index of the last value that is true for the given condition is 5, so the function returns 5.

LASTINDEXOF([1, 0, 1, 0, 1], Item > 0)
LASTINDEXOF(SourceArray, StartIndex, Count, Condition)
Returns the index of the last value that matches the condition, specified within the subset of SourceArray.
Parameters
SourceArray

Specifies the array from which to find the index.

Supported types: Numeric array; Boolean array; String array; Point array; Object array.
StartIndex

Specifies the beginning of the subset of the source array.

Supported types: Numeric.
Count

Specifies the number of elements to include in the subset of the source array. Note that the search begins from the item at StartIndex and proceeds backwards towards the first item, examining Count number of items.

Supported types: Numeric.
Condition

Specifies the condition that an element must satisfy for the function to return its index.

Supported types: Boolean.
Returns
Returned types: Numeric.
Examples
1.

In this example, the search begins at index 4, which has the string "Matrox", and counts backwards through the array, evaluating the condition for each item. The count ends with the first item of the array. There are 2 instances of the string "Matrox" within the subset, but the last one in the array was the first one to be found. The function returns 4.

LASTINDEXOF(["Matrox", "Design", "Assistant", "Matrox", "Imaging"], 4, 4, Item = "Matrox")