Forward and Reverse filtering a List field

Mike Bonner bonnmike at gmail.com
Fri Jun 18 17:54:44 EDT 2010


All you really need to do for this is to keep the "full dataset" in
storage somewhere. Since the field will be mutable, keep a variable or
property with the complete data, copy IT into your temp variable and
filter away. If your dataset isn't too too large this should work
fine. IE

Do your sql query, put the data into a script local variable. Then in
your filter handler, load the full dataset into a temp variable, do
your 4 consecutive filters so they're cumulative and put the temp data
into the output field.  And you still have your unchanged local
variable to check against on the next keypress.

While probably not the most optimized method, it seems acceptably fast
with 20k lines on my slug of a machine.

I've attached a sample stack, most of the code is in the stack script.


On Fri, Jun 18, 2010 at 2:42 PM, Mark Stuart <mstuart at adaptcrm.com> wrote:
> Hi All,
>
> Platform: WinXP
> revStudio: 4.0
>
> I'm building an app that populates SQL Server data into a list field
> that is defined as a table.
> The table data delimiter is the tab char.
> All this works fine.
>
> I'd like to build a filter system for the table data.
>
> The list would be "filtered" by typing a value into any column filter
> field, which is placed above each column.
> So if there are 4 columns, then there are 4 filter fields, having the
> possibility of an accumulative filter.
>
> Typing into or editing a filter field will filter the list for each
> character typed. Including backspacing a character or deleting any
> existing character.
>
> I've already built a prototype for this, and when typing a filter, the
> script works OK.
> In the "on rawKeyDown" handler, I first put the table data into a local
> variable and filter on it. Then put the variable back into the field.
> These ideas I got from searching the archive list.
> Problem is when I backspace a filter field character (conceptually
> reverting the filter), the data is not there, as it has already been
> filtered and put back into the field. Resulting in an incorrect data
> set.
>
> Question: so how do I build a filter system that can filter "forward"
> (typing ahead) and filter in "reverse" (editing existing filter value or
> "filter revert")?
>
>
> Regards,
> Mark Stuart
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>


More information about the use-livecode mailing list