filter question

Jim Ault JimAultWins at yahoo.com
Tue Mar 14 14:25:45 EST 2006


Hey, Chris, 

I know you probably don't have the time, but I am wondering why Phil's
solution did not work.  I use the filter command all the time and Phil had
the correct syntax and useage, as far as I could see.

Mostly just curiosity to find exceptions or tricky problems for future
reference.  Surprised it did not work.

Thanks,
Jim Ault
Las Vegas


On 3/14/06 11:01 AM, "Chris Sheffield" <cmsheffield at gmail.com> wrote:

> Thanks, Sarah.  I ended up going with a solution similar to this to
> get the job done.  I thought Phil's suggestion would have worked, and
> that's what I was trying to do, but unfortunately it didn't.
> 
> But thanks to all who responded.
> 
> Chris
> 
> 
> On Mar 13, 2006, at 5:08 PM, Sarah Reichelt wrote:
> 
>> 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"
>> 
>> 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"
>>> 
>>> 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
>>>> 
>>>> 





More information about the Use-livecode mailing list