Search Values of Array in "One Go"

Sannyasin Brahmanathaswami brahma at
Wed Aug 23 21:27:51 EDT 2017

Well thanks to all of you urging me to stay away from re-processing the array but going back to the dbase.

I Looked back at my code and realized that I *had* set it up to be re-usable, I just forgot how well I had done that 

I have this function in the behavior_Listen  which is attached to the stack

local sPlayListQueryA

command playlist_FetchData

# this handler gets everything we need from the dbase and assumes the column values for the query
# are set in the sPlayListQueryA


duh!  I had written everything I needed already!

I only needws to add this

on playList_FetchData pQueryArray
   if pQueryArray is not empty then # we are passing a query from the search behavior
      put pQueryArray into sPlaylistQueryA
   end if
and away we go, exact code to instantiate the entire play list of all audio items for that class is now reused to just fetch what the user wants.
Awesome… this  all I needed in my search behavior  was to set up  the query (values for column look ups)

     put tGenre into tFilterListQueryA["genre"]
     put tTheme into tFilterListQueryA["theme"]
         put tStringToFind into tFilterListQueryA["title"]
            put tStringToFind into tFilterListQueryA["subtitle"]
            put tStringToFind into tFilterListQueryA["description"]
            put tStringToFind into tFilterListQueryA["artists"]

   revealMoreActions "false"  # hide the form and fetch a new list from the dbase
   playList_fetchData tFilterListQueryA

all the discussion on speed seems mute in this context as the data sets are small an it happens in "the flash of an eye"

Thanks gentlemen, you saved me from going off the deep end re-parsing the local array!


On 8/23/17, 2:47 PM, "use-livecode on behalf of Mike Bonner via use-livecode" <use-livecode-bounces at on behalf of use-livecode at> wrote:

    I think you need to use ":memory:" as the name actually.  It looks (from
    the sqlite docs) that supplying no name creates a temporary db file.
    And now i'm curious.. Is there a way to attach the file based db to a
    memory db?
    IE Open the file database, then use the info here: and attach a memory database.
    Then (way over my head, but I seem to recall reading somewhere..) that one
    can use the results of a select to create a temporary table..  If
    interested, you might look here under create table as select...

More information about the Use-livecode mailing list