Creating a Search Field

william humphrey shoreagent at gmail.com
Tue Apr 29 10:29:19 EDT 2008


The fld "bigList" could be a dump of data from a SQL database or the search
code could be re-written to directly search the database?
At what point is it better to put the database in a search field and search
that or use SQL directly and search the database?  With the goal being a
list of results that shows up instantly as you type in the search field.


>
> I have three fields :
> - one is the list to be searched in (say "bigList") -- this field could
> have its visible property set to false
> - a second is a one line field where the user write what he/she is
> searching for (say "entry")
> - the third is a field where the results of the search appears (say,
> "results")
>
> the script of the  field "entry" is as follow :
>
> local mySubList,
> ---------------------
>
> ON rawkeyUp
>   find empty
>    REPEAT
>      find fld "entry" in fld "bigList" of this cd
>      IF the result is "not found" THEN exit repeat
>      ELSE
>      put value(the foundline) & cr after mySubList
>      END IF
>    END repeat
>    put empty into fld "results"
>    put mySubList into fld "results"
>    select char 2 to -1 of line 1 of fld "results"
>    select after fld "entry"
>    put empty into mySubList
> END rawkeyUp
>
> ON returnInField
> -- here do what you want with the found word
> (I use the found word to find a corresponding card in another stack)
> END returnInField
>
>
>
>
>



More information about the use-livecode mailing list