Search Values of Array in "One Go"

Mike Bonner bonnmike at gmail.com
Wed Aug 23 12:26:04 EDT 2017


I'm with bob on this.. If for some reason you can't use the database that
produced the array, shove the data into an sqlite db instead. In memory, or
if you need persistence a db file.

Alternatively, if you store your data flat rather than in an array. Then
you can....
repeat for each line tline in tData
  if tLine contains tSearchString then
       -- do whatever you want with tline
  end if
end repeat

You would still have to loop once through every record, but wouldn't have
the overhead of the subloop checking each column of each record for your
string.  It would just check the whole line.  (you could use itemoffset or
something of that nature, but its could be a pain to do so if the chosen
delimiter appears in the text. As a full string search of the line though,
it should work fine. )

On Wed, Aug 23, 2017 at 9:36 AM, Bob Sneidar via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Oh wait I see you ARE using an SQL database to begin with. Why would you
> then want to search an array?
>
> Bob S
>
>
> > On Aug 23, 2017, at 08:34 , Bob Sneidar via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> >
> > Yes. Don't use an array, use a memory based sqLite table.
> >
> > Bob S
> >
> >
> >> On Aug 23, 2017, at 08:24 , Sannyasin Brahmanathaswami via use-livecode
> <use-livecode at lists.runrev.com> wrote:
> >>
> >> OK I can make this work, (have to since I don't see another way)
> >>
> >> But it seems like a lot of looping.
> >>
> >> Is there a more efficient approach?
> >>
> >> BR
> >
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the Use-livecode mailing list