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

Re: Searching an Array?



John Sayre@GAPINC
10/14/98 01:30 PM
Sure... its not too hard.

When you load the array you need to keep track of the number of rows
inserted. Then do a while loop

$searchtext

while #ctr < #arrayrows
   add 1 to #ctr
   get $variable $var2 ......... from array(#ctr)
   if rtrim($variable,' ')=rtrim($searchtext,' ')
      break
  end-if
end-while

$searchtext & $variable acts like key in lookup
$var  ........................   are all of the returns you want

the if test breaks it out of the loop if key is found