Delete item won't work in Repeat for each loop

Ken Ray kray at sonsothunder.com
Wed May 24 17:41:01 EDT 2006


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

> Am I missing something? I think I must because I can't see what is
> wrong with the 1st script -- and Rev doesn't find a problem either
> because it executes without error. The data in the variable is just
> untouched and gets saved again intact.

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

HTH,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the Use-livecode mailing list