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

Passing Array as Parameter -Reply



There are a number of discussions in the archives for searching
an array.  The easiest to implement is keeping an 'index' in a
string of the unique 'key' values to indicate the element position in
the array.  Specifically, everytime you put something new into the
array you would append the $Index with a key value and delimiter.
 Then, when you wish to find something you would perform a
FIND on $Index looking for your key.  The position FIND returns
(divided by the length of your key value plus delimiter) would
indicate the element position in the array.  Then you can use GET
knowing exactly where the data is.

Example
$Index = 'One_Two_Thr_For'
wanting get the data from an array using key value of Thr.
Find 'Thr' in $Index 0 #Element
if #Elelement = -1
     do your add to array stuff
else
     let #Element = #Element / 4
     get DATA from ARRAY(#Element)
end-if

Hope this is helpful,
Dave