Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can use seek to perform like locate withg dowhile?
Message
From
16/09/2006 10:52:57
Mike Yearwood
Toronto, Ontario, Canada
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01153661
Message ID:
01154372
Views:
9
>How can I duplicate the following code using the seek command:
>
> SCAN
> SELECT Invoice
> LOCATE FOR in_code = lnCustCode
>   DO WHILE FOUND()
>     do some code
>     CONTINUE
>   ENDDO
> SELECT sometable
> ENDSCAN
>
>
>The is extremely slow as this codes is already in another loop and therefore a locate for the whole table is execute each time.

If you have an index on in_code in invoice the locate will become much faster. Caching will then also improve the performance of subsequent LOCATEs in the next run of the outer loop.

Although, the seek will be faster yet. If you can get sufficient performance by just adding the in_code tag, don't bother changing the code.
Previous
Reply
Map
View

Click here to load this message in the networking platform