Delete item won't work in Repeat for each loop

Ian McKnight iangmcknight at googlemail.com
Wed May 24 17:52:32 EDT 2006


Hi Ken

I think I see whats happening. I'm not altering the original data in
theImportedData variable rarther the copy of the data thats in the
loop variable. So unless I store this -- I lose it.

And in the second example I am altering the original.

That's great. This was my preferred solution because I was aware of
the problem that Mark hilighted regarding deleting items and using
'down to' in a loop,


Thanks to for your help.


Ian McKnight

On 24/05/06, Ken Ray <kray at sonsothunder.com> wrote:
> On 5/24/06 4:35 PM, "Ian McKnight" <iangmcknight at googlemail.com> wrote:
>

> That's because in the first version, you're not actually changing
> theImportedData (which you can't really, without getting odd results). You
> need to do this:
>
> on removeFields1
>   put "" into tNewData
>   repeat for each line theRecord in theImportedData
>     delete the last item of theRecord
>     delete word 2 of item 10 of theRecord
>     delete item 11 of theRecord
>     put theRecord & cr after tNewData
>   end repeat
>   delete char -1 of tNewData
>   put tNewData into fld "Newdata"
> end removeFields1
>



More information about the use-livecode mailing list