>>This code is kind of 'asking for trouble' :)
>>U can achieve much cleaner solution, by inserting new records into temporary cursor of the same structure while scaning original table and then simply dump them in after main scan is done.
>>
>>so code cld look something like this ;
>>
>>
>>SELECT MyTable
>>local aStru(1)
>>afields(aStru)
>>create cursor tmpTable from array aStru
>>SELECT MyTable
>>go top
>>scan
>> .
>> scatter to laArray
>> .
>> do case
>>
>> case ...
>> insert into tmpTable from array laArray
>>
>> case ...
>>
>> endcase
>> .
>>endscan
>>.
><b>append from dbf("tMyTable")
>>.
>>
>>
>>
>
>The bolded is the correction.
>
>But if I understand well, the original problem was that the appended >records weren't processed at all. That'd be better solved with what Sergey >proposed, to save the current record's recno() before inserting, and GoTo >it afterwards.
Yes, You are right I overlooked that part. The way I proposed they wld not be processed either, But nor wld the old records, as pointer wld jump to eof and mess up scan/endscan . (Sergey pointed it out I think).
My aim was to suggest keeping things clean, as scan/processing and adding into the same alias is not something i particularly like :)
As this is an old procedure I agree, Sergey's solution
wld be much easier way out, provided that index order is off.
As for my metacode 'bug', correct wld be ;
append from dbf("tmpTable")
as alias 'tMyTable' is nowhere to be found! :)
Cheers :)
Srdjan