Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can use seek to perform like locate withg dowhile?
Message
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:
01153665
Views:
17
This message has been marked as the solution to the initial question of the thread.
>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.
Made index by In_Code in Invoice table, then try
SELECT Invoice
SET ORDER TO InCodeTagName
SELECT sometable
SCAN
  SELECT Invoice
  SEEK lnCustCode
  SCAN WHILE In_Code = m.lnCustCode
       do some code
       SELECT Invoice && Not neccessary but I prefere to put it
  ENDSCAN
  SELECT sometable
ENDSCAN
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform