A chunking mystery

Jim Ault JimAultWins at yahoo.com
Fri Mar 14 03:01:00 EDT 2008


> David Coker wrote:
>>   repeat for each line thisLine in tSource
>>     if item 2 of line 1 of tSource = "0" then
>>       delete line 1 of tSource
>>     end if
>>   end repeat 

I am not sure exactly what you are trying to but your repeat is not going to
work the way you have it  structured.

First, if you want to use repeat for this, follow Phil's suggestions.
Secondly, there may be an easier way to do the task I think you want.
Assuming the itemDel is a tab then

filter tSource without ("*" & tab & "0" & tab & "*")
or commas
filter tSource without ("*,0,*")
--of course, this will delete lines with any 0 in item 2 through the second
to last.  This may or may not be a problem for your data set.

Both methods are virtually instant, so don't worry about speed.

Hope this helps

Jim Ault
Las Vegas 


> David Coker wrote:
>> Hello folks,
>> I have a handler built that does nothing more than checking for a zero
>> in a specific item located in a scrolling text field and if found,
>> deletes the entire line. It seemed to work flawlessly with all of the
>> test files that I had chosen to work with while building the app. No
>> problem, I thought.
>> 
>> Then I started using an assortment of real data (all CSV format, with
>> the target item in the same location), only to find that I was getting
>> unreliable results. I have a fairly large data file where the app
>> always works, yet another much smaller one that the target zeros are
>> almost ignored. I can mix and match sample data from both files and
>> get varied results. I've even tried sorting the field to get them up
>> to the top of the file, but that doesn't seem to make a difference.
>> 
>>   repeat for each line thisLine in tSource
>>     if item 2 of line 1 of tSource = "0" then
>>       delete line 1 of tSource
>>     end if
>>   end repeat
>> 
>> The sample files I'm using came from different sources, but are
>> otherwise identical in general composition, structure and delimited
>> format. Any ideas as to what I need to be looking for? Still using the
>> 2.51 studio version. (bummer!)
>> 
>> I'd totally appreciate any boost in the right direction.
>> David





More information about the use-livecode mailing list