Filtering Columnar Data
Mark Schonewille
m.schonewille at economy-x-talk.com
Mon Jul 16 16:14:56 EDT 2007
Here's another solution. Really.
function quickSortAndFilter theData,theItemNr,theFilter
set the itemDel to tab
sort lines of theData by (item theItemNr of each is not theFilter)
repeat for each line myLine in theData
if item theItemNr of myLine is theFilter then
put myLine & cr after myNewData
else
exit repeat
end if
end repeat
return myNewData
end quickSortAndFilter
Let me add some explanation:
- theData is tab-delimited data
- theItemNr is the number of the column you want to search
- theFilter is the string you want to search for
Best regards,
Mark Schonewille
--
Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http;//www.salery.com
Quickly extract data from your HyperCard stacks with DIFfersifier.
http://differsifier.economy-x-talk.com
>
>
> Op 16-jul-2007, om 17:58 heeft Gregory Lypny het volgende geschreven:
>
>> 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.
> <snip>
More information about the use-livecode
mailing list