Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCAN FOR ... WHILE
Message
From
14/05/1999 13:28:36
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
SCAN FOR ... WHILE
Miscellaneous
Thread ID:
00219112
Message ID:
00219112
Views:
62
I've been using this technique for a while. I thought that the SCAN FOR would start at the top of the file and act as a filter only looking at records that meet the condition and the WHILE would cause the loop to end as soon as its condition was false.

This is just a bogus example to illustrate the point.
lnInvoiceHdrId = Invoice.iInvoiceHdrId

llTableUpdateOk = .T.

SELECT InvoiceDtl
SCAN FOR InvoiceDtl.iInvoiceHdrId = lnInvoiceHdrId WHILE ;
         llTableUpdateOk
     llTableUpdateOk = TABLEUPDATE( .F., .F., "InvoiceDtl" )

ENDSCAN
I thought that this would start at the top of the file and find all Invoice details that matched that Id and continue until it hits the end of the file or when the tableupdate fails.

Similaray SCAN has an implicit WHILE NOT EOF() by itself.

So does the SCAN WHILE without a FOR start at the top of the file or does it start from the current record positioning and move forward?
Next
Reply
Map
View

Click here to load this message in the networking platform