Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
'SCAN FOR' vs 'LOCATE FOR'
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00301450
Message ID:
00301616
Views:
35
Hi Chris..

Oops... thanks for catching this...:)

Yes, you do need to set the order.. You did'nt miss a thing!!

Thanks again for clarifying this...

>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform