Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
'SCAN FOR' vs 'LOCATE FOR'
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00301450
Message ID:
00301602
Vues:
26
>Hi Chris...
>
>As everyone has pointed out, these commands are rushmore optimizable. However, that isn't the real key to the speed. First off, the FOR operator will evaluate ALL records. Instead, it is much faster to use a combination of Seek and Locate.
>
>For example, lets say you wanted to loop through the records where state = "PA". Something like this would be much faster:
>
>Select customers
>If Seek("PA","customers","state")
> Scan While State = "PA"
> */ Do your stuff
> EndScan
>Endif

Don't you need to explicitly set the order to optimize this? In other words, the SEEK("PA", "customers", "state") doesn't set the order of the records before the SCAN is done, or am I missing something?

Select customers
Set order to state
If Seek( "PA" )
Scan While State = "PA"
*/ Do your stuff
EndScan
Endif
Chris McCandless
Red Sky Software
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform