Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCAN ENDSCAN with INSERT statment...
Message
From
30/11/2004 14:17:15
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
30/11/2004 05:07:23
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
OS:
Windows XP SP1
Miscellaneous
Thread ID:
00965286
Message ID:
00965795
Views:
10
>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")     && need dbf() here</b>
>.
>
>
>
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.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform