filter question

Sarah Reichelt sarah.reichelt at gmail.com
Mon Mar 13 19:08:01 EST 2006


It might be faster to filter the list simply to reduce it to lines
that contain the filter string anywhere, and then do a loop to check
if the filter string is in the correct item.

-- gather the original data and the required settings
put fld "List" into tList
put fld "Filter into Filter
put 3 into tItemNum

-- do the first filter to reduce the list
filter tList with "*" & tFilter & "*"

-- loop through making sure it appears in the right item
put empty into tMatches
repeat for each line L in tList
  if item tItemNum of L contains tFilter then put L & cr after tMatches
end repeat

-- remove the trailing cr
delete last char of tMatches

-- display the matching results
put tMatches into fld "Results"


Cheers.
Sarah

On 3/14/06, Phil Davis <davis.phil at comcast.net> wrote:
> Hi Chris,
>
> To filter on column 3, are you using something like this?
>
>    put fld "list" into tList
>    filter tList \
>        with "*" & tab & "*" & tab & fld "filter" & tab & "*"
>    put tList into fld "list"
>
> If so, it seems like that should work.
>
> Phil Davis
>
>
> Chris Sheffield wrote:
> > I'm trying to apply a filter to a list field.  The columns of the  field
> > are tab delimited.  I have a separate "filter" field that  allows the
> > user to apply a filter to the list based on whichever  column is the
> > current sort column.  I can get the filter to work fine  so long as the
> > first column is selected, but anything else does not  work.
> >
> > How can I apply a filter to a list based on say item 3 of each line  of
> > that list?  Is that possible?
> >
> > Thanks,
> > Chris
> >
> >
> > ------------------------------------------
> > Chris Sheffield
> > Read Naturally
> > The Fluency Company
> > http://www.readnaturally.com
> > ------------------------------------------
>
> _______________________________________________
> 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