Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can use seek to perform like locate withg dowhile?
Message
From
14/09/2006 10:08:08
 
 
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:
01153671
Views:
11
>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.
>
>Thanks in advance.


If you have in_code as a key in INVOICE then you could use INDEEXSEEK(). This does a seek without actually moving the file pointer (unless desired). This works especially if you have INvoice's order set to In_Code
 SCAN
   lnIn_Code = In_Code
   If INDEXSEEK( lnIn_Code, .T., "Invoice", "In_Code")
       SELECT Invoice
       SCAN WHILE In_Code = lnIn_Code
         do some code
       ENDSCAN
       SELECT sometable
   EndIf
 ENDSCAN
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Previous
Reply
Map
View

Click here to load this message in the networking platform