[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Searching an Array? -Reply



The best I can answer is to build a psuedo-index when you PUT
something into the array.  For example, identify a unique key structure of
each row of the array and append this value to a string variable.  Be sure
each element of the key structure is the same length (ie five characters).
You can then use FIND against the string variable holding the 'index' to
identify the row in the array.

If you are looking for a different kind of search you may need to develop
a where loop and a counter.  Initialize the counter to 0, get element 0 from
array and compare against what you are looking for.  Success should
break the where loop, failure increases the counter and continues in the
where until counter exceeds the number of elements in the array.  This
may be useful if you are looking for a particular value in one of the
columns/fields of the array.  If you build it as a local procedure you could
pass the value being looked for, the field to search against, the name
of the array, and then the return value(s).

Dave