Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting a Winner
Message
De
04/06/1999 14:07:17
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00226460
Message ID:
00226641
Vues:
27
Hi Bruce, Gary:

Good idea, Bruce...here be da code
=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
>>Our company is creating a sweepstakes application that will randomly select a winner each month. We are having difficulty putting code together that will help us select a winner. We are using one table that has two fields in it. A three letter code (AFS) field and a dateime field. Does anyone have any simple code that might be helpful in selecting a winner or have any ideas on how to generate a winner.
>
>You could just pick a random-selection winner based on the number of records using RAND(), if there's no other criteria involved...
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform