Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting a Winner
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00226460
Message ID:
00226924
Vues:
23
>>=RAND(-1) && Initialize to system clock
>>SELECT table
>>COUNT TO nMaxValue FOR !DELETED()
>>nWinnerRecord=INT(1+RAND()*nMaxValue)
>>GO nWinnerRecord && This is the winning record
>
>:)) You forgot the deleted records just before your last line of code. :)

I thought he just assumed SET DELE ON, the usual state, so COUNT will return only the non-deleted records. After all, if it's OFF, then the code can break anyway, since you may GO to a deleted record...so his code is either okay, or else the slight addition of !DELETED() will not help it...make sense?
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform