arraysearch(
ARRAY
,
TEXT
,
POSITION
,
SEPARATOR
)

The arraysearch( function searches a text array or a data array (see Text Arrays and Data Arrays) to see if it contains a specific value.


Parameters

This function has four parameters:

array – is the array you want to search.

text – is the text that you want to search for. This parameter may contain the wildcard characters ? and *. For example, to search for array items that start with John use John*. To search for any array item containing Pacific use *Pacific*. The array item must match the text exactly, including upper/lower case. For more information on wildcard characters, see the matchexact operator.

position – is the spot in the array where you want the search to begin from. If you want to search the entire array, this parameter should be one.

separator – is the separator character or characters for this array. This parameter is omitted if the target array is a data array.


Description

The arraysearch( function searches an array to see if it contains a specific value. If the function finds an array element that matches what you are searching for it returns the number of that array element (1, 2, 3, etc.). If there is no matching element, the function returns 0.

arraysearch("alpha/bravo/charlie","bravo",1,"/") ☞ 2
arraysearch("alpha/bravo/charlie","c*",1,"/") ☞ 3
arraysearch("alpha/bravo/charlie","C*",1,"/") ☞ 0
arraysearch("alpha/bravo/charlie","a????",1,"/") ☞ 1
arraysearch("alpha/bravo/charlie","a?",1,"/") ☞ 0

Working with Data Arrays

This function works with both data and text arrays. Because Data Arrays have no separators between elements, the separator parameter is omitted when targeting a data array.

When used with a text array, the arraysearch( function has four parameters. With data arrays, it has only three and, if the start position for the search is the first element, that parameter can also be omitted, as in:

arraysearch(dataarray(3.94, 12.1, "blue", 801.9, 47.50), 801.9)  ☞ 4

Wildcards are allowed in a text array search but not in a data array search. If a search fails, zero is returned.


See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0 but more than one character is now allowed for use as the separator parameter.