Filtering Columnar Data
Gregory Lypny
gregory.lypny at videotron.ca
Mon Jul 16 11:58:26 EDT 2007
Hello Everyone,
I'm struggling with the filter command. I have tab-delimited data in
a field, where each row has at least 56 columns. I want to filter
the data based on a chosen number in that fourth column, for example,
to return all lines that have a 9 there. The fourth column only
contains a number from 1 to 10. The following handler works most of
the time. I put three wild card expressions, lone asterisks
separated by tabs, to make sure nothing is being picked up in the
first three columns. The tab and asterisk (and it could be just an
*) following myNumber says that it doesn't matter what is in the
columns after the fourth.
put fld "Data" of this card into tmpData
filter tmpData with "*" & tab & "*" & tab & "*" & tab & myNumber &
tab & "*"
The trouble is, the first three wild card expressions are interpreted
by Revolution to include tab characters, which means that I'm not
necessarily filtering the fourth column! If a 9 appears by itself in
column 58, then the filter command will pick it up. Sigh.
I also tried the following, but I don't think I have the regular
expression syntax right.
filter it with "[A-Z0-9]" & tab & "[0-9]" & tab & "[A-Z]" & tab &
myNumber & tab & "*"
I know that my first column always contains five words, two of which
are numbers. I wasn't sure how to represent the four spaces between
the words. The second column is always a seven-digit number. The
third contains first and last names, which will contain at least two
words. This turns up empty.
Any advice would be most appreciated. If I can't get the RegEx
working for me, I know I can resort to a repeat loop and pull out all
lines with myNumber in the fourth item.
Regards,
Gregory
More information about the use-livecode
mailing list