pete at lcsql.com
Mon Jun 18 13:38:22 EDT 2012
Have you taken into account that the data you are filtering may be out of
date by the time it gets filtered in memory because data was either added,
changed, or deleted in your database?
That's an application-dependant issue of course so maybe it either doesn't
matter or can't happen in your app.
lcSQL Software <http://www.lcsql.com>
On Mon, Jun 18, 2012 at 10:00 AM, Bob Sneidar <bobs at twft.com> wrote:
> Hi Dick.
> For simple arrays this will work well. I am envisioning large datasets,
> and I want to filter based upon a substring being present in a list of
> columns I provide. The goal is to create a comprehensive find field that
> works much the way a Spotlight search works, only on SQL data.
> Some will say, "Why not just query your SQL database over and over?" Good
> point, but the process of requerying a database, particularly one like
> On-Rev's from a remote location seems a little too much, but it does bring
> up an interesting point: What if I can save an array as a memory based
> sqLite table (it would have to be very specific in it's structure, say a 2
> dimensional array like the one a Datagrid uses) and then I could query the
> sql table extremely quickly.
> This is the line I am taking at present.
> On Jun 15, 2012, at 8:21 PM, Dick Kriesel wrote:
> > On Jun 15, 2012, at 3:21 PM, Bob Sneidar wrote:
> >> Hi all.
> >> I am wondering if anyone has developed an Array Filter procedure that
> would give me all the rows of an array matching a certain criteria? For
> instance, let's say I wanted all the rows whose key "name" contained "bob"
> and have it returned as an array of the same structure containing only
> those records?
> >> If not I am going to have to write one.
> >> Bob
> > Hi, Bob. Here's an example for a simple array. Put it into a script
> and run "test1" from the message box.
> > Does it work for you?
> > -- Dick
> > <postscript>
> > function subarrayForNameContainsString @rArray, pString
> > local tArray
> > repeat for each key tKey in rArray
> > if rArray[ tKey ][ "name" ] contains pString then
> > put rArray[ tKey ] into tArray[ tKey ]
> > end if
> > end repeat
> > return tArray
> > end subarrayForNameContainsString
> > on test1
> > local tArray, tSubarray
> > put "Betty" into tArray[ 123 ][ "name" ]
> > put "Bob" into tArray[ 234 ][ "name" ]
> > put "carpenter" into tArray[ 234 ][ "occupation" ]
> > put subarrayForNameContainsString( tArray, "Bob" ) into tSubarray
> > breakpoint
> > end test1
> > </postscript>
> > _______________________________________________
> > 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:
More information about the Use-livecode