Filtering Columnar Data

Ken Ray kray at sonsothunder.com
Sat Dec 10 00:06:07 EST 2005


On 12/9/05 10:26 PM, "Gregory Lypny" <gregory.lypny at videotron.ca> wrote:

> Not sure I understand, Ken.  Your first statement puts searchString
> in the fifth column, while the second puts it in the fourth.  If I
> changed mine to
> 
> filter theData with "*" & tab & searchString & tab & "*"
> 
> or
> 
> filter theData with "*" & tab & searchString & "*"
> 
> it would still find the string in the second column, but perhaps in
> higher columns too because the pattern can be shifted right.

That's right. That's why to match a specific column, you need to include
*all* the columns in your filter command. So for a 5-column set of data, in
order to specify the second column and only the second column you'd do:

  filter theData with "*" & tab & searchString & tab & "*" & tab & \
    "*" & tab & "*"

and to filter on only the fourth column of 5, it would be:

  filter theData with "*" & tab & "*" & tab & "*" & tab & \
   searchString & tab & "*"

The only issue is when you're matching the last column... you have to make
sure you *don't* put a "*" after the last column, so it would be:

  filter theData with "*" & tab & "*" & tab & "*" & tab & \
   "*" & tab & searchString

and not 
 
  filter theData with "*" & tab & "*" & tab & "*" & tab & \
   "*" & tab & searchString & "*"


But perhaps repeat for each is a better choice for you...


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list