Performs a sequential search for "needle" in array "haystack", starting at "offset". Comparison is equivalent to the EQ operator. (i.e. looks for an exact match)
miva_array_find( needle, haystack var, offset )
Returns the index of "needle" in "haystack" or 0 if the element was not found.
  • needle = value to search for
  • haystack var = the array to search
  • offset = the starting index position
User Annotations: miva_array_find
scot ranney : scot at, scotsscripts d0t com
06/26/2018 14:57 p.m.
The array to be searched needs to be a "simple" array- no structures.

The script below will evaluate 2, the index of the found item. 

Trim and tolower is useful here because it's looking for an exact match.
<MvASSIGN NAME = "l.array" INDEX = "1" VALUE = "dog">
<MvASSIGN NAME = "l.array" INDEX = "2" VALUE = "cat">
<MvASSIGN NAME = "l.array" INDEX = "3" VALUE = "tree">

<MvEVAL EXPR = "{ miva_array_find('cat',l.array,0) }">