Forward and Reverse filtering a List field

Mark Stuart mfstuart at cox.net
Fri Jun 18 19:27:19 EDT 2010


Hi Mike,
First thanks for replying.
How do I see/dl your attachment. I'm using the Browser to view the list, and
therefore don't see any option for dl.
Unless of course you also replied to my personal email, which I haven't
received yet.

Here's what I have so far...

Stack objects:
button: Load Accounts
fld: Filter
fld: List

Load Button script:
--===
global dbConnID, gList

on mouseUp
   put revOpenDatabase("odbc","adaptSAMPLE",,,,) into dbConnID
   
   if dbConnID is not a number then
      answer error "DB Connection error:" && dbConnID
      exit to top
   end if
   
   put "SELECT Account_Number,Account_Name,Account_Manager FROM account
ORDER BY Account_Name" into tSQL
   
   put revDataFromQuery(,,dbConnID,tSQL) into fld "List"
   set the itemDel to tab
   sort lines of fld "List" by item 1 of each
   put fld "List" into gList  --put the returned data into a global for use
in the filter
end mouseUp
--===


fld List script:
--===
global gList
local tList

on rawKeyDown
   put gList into tList
   put the text of me into tText
   filter tList with tText & "*"
   put tList into fld "List"
   pass rawKeyDown
end rawKeyDown
--===

For each key stroke the script gets the original data and puts it into the
local tList var.
So it filters on the original data set for each key stroke. This could be
slow.

The Filter fld script seems to work, but the behavior is a little strange.
When typing in the first character (for a starting value in the list I know
is there), it does nothing - it does not filter.
When I type the second character, it is like it is the first character typed
in. It seems it's one character behind in applying the filter.

What's up with that? Is my script anywhere near to work correctly and
efficiently?

Regards,
Mark Stuart
-- 
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Forward-and-Reverse-filtering-a-List-field-tp2260720p2260846.html
Sent from the Revolution - User mailing list archive at Nabble.com.



More information about the use-livecode mailing list