FindIndex question

Bob Sneidar bobsneidar at iotecdigital.com
Mon Mar 25 14:07:20 EDT 2024


I’ve thought about that. A temporary memory database would not appear to the user to be faster, as the initial query for a large dataset will happen all at once during which Livecode would be unresponsive. And if you page the queries from the live database, re-storing the data in a memory database would just be added time. 

You could use send in time to cache forward and backwards a few pages, and in that case a memory database could help, but if the user drags the elevator box (how many people know what THAT is) then you go back to square 1 concerning efficiency. 

Bob S


> On Mar 25, 2024, at 10:34 AM, Mike Kerner via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> i would be curious to know if an in-memory sqlite db increases scroll speed
> with dg's.
> basically, you would live load the dg with pages from the db.
> i can't imagine that the dg is faster than the pg. everything i've tried
> with the pg is faster than the dg.
> just one more reason to resurrect the script compiler and release it.
> 
> On Mon, Mar 25, 2024 at 11:16 AM Bob Sneidar via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> 
>> I wrote a findInArray() function that will convert an array to a memory
>> based SQL database, and one of the arguments is the SQL query statement to
>> use on the database. I have another called FilterArray() which simply
>> iterates through the keys to output those matching a criteria.
>> 
>> Bob S
>> 
>>> On Mar 24, 2024, at 2:22 PM, Neville Smythe via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>>> 
>>> 
>>>> On 25 Mar 2024, at 3:00 am,Mike Kerner wrote:
>>>> 
>>>> i don't know if you dove into the code, but it's too early to think
>> about
>>>> unpacking this, so  here's the code: ...
>>> 
>>> Thanks Mike
>>> 
>>> While I was aware of the optional parameters feature of LC commands I
>> have never used it I so was unfamiliar with the syntax. The penny had never
>> dropped that the parameter list for a command is just an array, so
>> evidently you can actually send an array instead of a comma delimited list
>>> 
>>> Which means that you can send FindIndex a single parameter pKeyPairsA
>> which is an array with alternating colName,searchStr values
>>> 
>>> Setting up such an array is not particularly convenient for coding
>> however. My workaround had been to use a custom function hack
>>> 
>>> function myFindIndex pDataGrid, pKeyPairs
>>>  — pKeyPairs is a comma delimited list such as
>> “colname1,str1,colname2,str2,..”
>>> 
>>>   replace comma with quote & comma & quote in pKeyPairs
>>>   put “dispatch FindIndex to” && pDataGrid && “with” && quote &
>> pKeyPairs & quote into tCommandStr
>>>   do tCommandstr
>>>  put the result into tFoundIndex
>>>  ...
>>> 
>>> A much more elegant (if probably no faster) solution is
>>> 
>>> function myFindIndex pDataGrid, pKeyPairs
>>>  — pKeyPairs is a comma delimited list such as
>> “colname1,str1,colname2,str2,..”
>>> 
>>>   set the columnDelimiter to comma
>>>   split pKeyPairs by column
>>>   dispatch “FindIndex" to pDataGrid with pKeyPairs
>>>  put the result into tFoundIndex
>>>  ...
>>> 
>>> 
>>> BTW, where did you find the source code for DataGrid handlers? I now see
>> how one could write a FindIndices function to return all indices rather
>> than just the first found … or even a general WHERE  search :-)
>>> 
>>> Neville Smythe
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> 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
>> 
> 
> 
> -- 
> On the first day, God created the heavens and the Earth
> On the second day, God created the oceans.
> On the third day, God put the animals on hold for a few hours,
>   and did a little diving.
> And God said, "This is good."
> _______________________________________________
> 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