Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Scan / Endscan and processing logic
Message
 
 
À
04/07/2006 02:29:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01127322
Message ID:
01133615
Vues:
22
>>>>>Does it have to be SCAN/ENDSCAN?
>>>>
>>>>I can use DO WHILE instead, but I always prefer SCAN.
>>>
>>>Thtat's not what I had in mind. Can it be done using SQL commands?
>>
>>Ok, finally I've realized, that I can not use scan/endscan and I have to switch to
>>
>>for i=1 to reccount() + 1
>>
>>next
>>
>>Thanks.
>
>Alowing that you missed 'skip' in a hurry, hv to ask ;
>What is the diff ? It comes down to the same any way you turn it.
>Weather u r doing for/skip/next or dowhile/skip/enddo or scan/endscan,
>you are basically going arround the same bush.
>
>If you need to go trough records one by one, then by all means
>you should use scan/endscan which is designed for that.
>It spares you of ugly eof/bof traps and does skip for you. What can you possibly gain by doing for/skip/next unless, that 'I' counter is your goal :))

You missed the fact, that I'm looping for reccount() + 1. In other words, I do additional cycle for last record and I also made my if statement slightly different
if not cCarrier_Name == m.lcCarrier_Name or m.lnI = reccount() + 1
   * create file, etc.
endif
In other words, I needed to create a file for each different client and each different carrier. If I'm using scan/endscan, I have to repeat the code after the scan to create file for the last set of client/carrier. Originally I added a check in scan itself and was surpised, that my eof() or reccount() = recno() didn't work. But then I realized, that my logic dictates one additional loop, that I was able to achieve with for loop.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform