Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
New VFP feature I didn't know about. Did you?
Message
 
 
À
21/07/2000 14:03:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00395202
Message ID:
00395605
Vues:
9
You just disproved your Gotcha. I will bet a steak dinner you got a "Not Found: ..." the same number of times as the # of records in the gameInfo table.

Your code is exactly correct. The EOF() is returning true for the EOF of GameMask, NOT GameInfo. Even though GameMask is at EOF, GameInfo is not. Therefore, ENDSCAN is reselecting the GameInfo even though the currenlty selected work area is at EOF and continuing with the next record in GameInfo. The loop continues until EOF('GameInfo') regardless of the EOF('GameMask') condition.


>I just tried this program in FP 2.0 and it runs fine to expected completion, and I get a "Not Found: ..." for each and every record.
>
>close all
>select 0
>use gameinfo
>select 0
>use gamemask
>select gameinfo
>scan
> ? name
> select gamemask
> ** force an eof (all fields are uppercase)
> locate for gamemask.abbrv = "xxx" && gameinfo.abbrv
> IF eof() && !found()
> ? "Not Found: "+gameinfo.abbrv
> ENDIF
>
>endscan
>
>
>>THERE IS A HUGE GOTCHA WITH THIS "FEATURE"
>>
>>If, in the course of your scan loop the currently selected alias (not the alias you are SCANning) ends up on EOF(), then, when you hit the END SCAN you will exit the loop even though you are not EOF() on the actual alias you're scanning.
>>
>>ALWAYS reselect the alias you are scanning before the END SCAN
>>
>>
>>>Well I can't check 1.x, but it works that way in FP 2.0!
>>>
><snip>
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform