CGI and find

J. Landman Gay jacque at hyperactivesw.com
Tue Sep 2 23:09:02 EDT 2003


On 9/2/03 8:37 PM, Richard Gaskin wrote:

> I may have missed something from earlier, but might it be simpler and
> fasterto use offset into a block of text rather than marking cards in a
> stack?

Yeah, you're a little behind. ;) Apologies to those who are tired of 
this thread...

I want to search a whole stack for a series of words. Last year I 
couldn't get "find" to work in a cgi, so I did write an offset script 
that plodded through each field on each card looking for the words. It 
was limited to returning only those cards where the whole phrase was in 
a field because that's all offset can easily do.

Today I decided to muck around again with "find" in a cgi. This time I 
sort of got it to work, with some limitations -- mainly, plain old 
"find" doesn't exit a repeat loop properly in a cgi, but marking by 
finding seems to mostly work. This allows my script more flexibility, in 
theory, because I can use "find whole" or "find" or "find string", etc. 
(Except that I'm now having some problems with finding cards containing 
all the words if they aren't together in a field, but that's something I 
haven't worked through yet. Maybe it is related to the same thing that 
causes regular "find" to fail.)

As far as speed goes, my offset routines take about twice as long as 
marking cards and then gathering data from those cards. I assume the 
extra time is due to the double repeat loop I have to use to look at 
every field on every card. The script does exit the inner repeat loop if 
it finds even one instance of the search phrase, so not every field 
necessarily gets examined. But even so, offset takes longer.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list