Filtering Columnar Data
JimAultWins at yahoo.com
Mon Jul 16 13:47:01 EDT 2007
This should work quickly enough for you:
filter tmpData with "*"&tab&myNumber&tab&"*"
-- => good hits + false hits only
set the itemdel to tab
repeat for each line LNN in tmpData
if item 4 of LNN is myNumber then put LNN & cr after newTempData
-- => newTempData should be the hit list
another approach that might help you in some way
sort lines of tmpData numeric by item 4 of each
On 7/16/07 8:58 AM, "Gregory Lypny" <gregory.lypny at videotron.ca> wrote:
> 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.
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
More information about the Use-livecode