bobs at twft.com
Mon Jun 18 12:00:41 CDT 2012
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.
> 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
> 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
> end test1
> 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