Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DO WHILE vs SCAN WHILE...?
Message
From
24/06/2005 02:14:05
 
 
To
23/06/2005 19:42:25
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01026042
Message ID:
01026170
Views:
18
>>What would be the difference in using DO WHILE vs SCAN WHILE...?
>>Is there a performance issue?
>>
>>Thanks in advance, M.
>My preference is for SCAN. In addition to what has been said, I think it is slightly cleaner especially if you have both a WHILE and FOR clause.
>
>One thing to be aware of, however. Nested SCANs do not work as expected because of the extra SKIP at the second ENDSCAN.


Here is workaround shown on Dragan's code .
scan 
   <...some code>
      
      scan while &WhileCondition
         <more code>

           scan while &InnerWhileCondition
              <more code>
           endscan   
           skip -1   && Workaround to 'rewind' table one skip back

      endscan   
      skip -1        && will do the trick

endscan   
Nested scans will work properly like this.

Also, additional FOR clauses in inner scans might 'mess up'
smooth, top to bottom flow in above scenario

Rgds++
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Previous
Reply
Map
View

Click here to load this message in the networking platform