Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Scan...EndScan still a problem?
Message
De
06/12/2001 09:53:29
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
05/12/2001 18:42:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00589532
Message ID:
00590517
Vues:
34
>>I remember reading several years ago that Scan...EndScan loops should not be nested because some records do not get processed properly. Is this still the case in VFP7?
>>
>>Thanks very much.
>>Stan
>
>You only need to be careful if you have a FOR condition which is optimisable AND you are changing key values within the loop. No problem with nesting, except if you are scanning the same table, in which case store the pointer.

Dave, the slight problem here turned up because the innner scan would land on the first record which was not satisfying the condition, and the outer scan would need to operate on the last record which was used in the inner scan, therefore I would be doing it this way, adding the while condition and saving the recno() as the last thing in the inner scan. Of course, this example serves a different purpose: your way, each scan is performed for each record; my way, the inner scan is performed on each record, and the outer sees the first record of each group before the inner scan comes up, and then the last record of the group when it exits.

>SELECT TableA
>SCAN
> do something
> SCAN while something
> do somethingelse
> nRec= RECNO()
> ENDSCAN && TableA
> GO m.nRec
>ENDSCAN && TableA

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform