Thank you for this..it worked great! How can I get it to list just one. When I hit refresh, of course, it calc's another one and so on.
Is there a way to just list the first on it comes up with and then stays there? Thanks again Steve On 3/31/03 4:15 PM, "Robert Garcia" <[EMAIL PROTECTED]> wrote: > Do a search action returning the whole list, you don't need all the > fields, maybe even just the id. > > <@assign local$wholeList @@resultSet> > > <@assign local$winningRow <@random low=1 high=<@numrows > array=local$wholeList>>> > > <@assign local$theWinnerIs <@var local$wholeList[@@local$winningRow,*]>> > > That should do it. > > Robert. > > On Monday, March 31, 2003, at 02:05 PM, Eric Weidl wrote: > >> Hi, >> >>> I'm building a random drawing system and all I'm going to do is >>> insert a >>> random number in a column of an array and then sort the array and >>> whoever is >>> at the top is the winner. >> >> How are you ensuring that each random number in the array is unique? >> >> If you aren't, then how do you decide who's the winner if 2 or more >> people have the same random number? >> >> Are you sorting ascending or descending? How do you decide? It will >> affect who wins. >> >> >> Here's a method we've successfully used in the past to identify a >> random winner from a set of users. >> >> >> 1) Do a select action to get all the eligible contestants and their >> information. You could sort the data or not. >> >> 2) In the results HTML for the search action, put the following code >> (modified for your table/column names, of course): >> >> >> <@! Set the range for the random number selection > >> <@ASSIGN local$randomRangeLow VALUE="1"> >> <@ASSIGN local$randomRangeHigh VALUE="<@NUMROWS>"> >> >> <@! Pick a random winner from the range. The winnerIndex is the row >> number of the winner. > >> <@ASSIGN local$winnerRowIndex VALUE="<@RANDOM LOW='<@VAR >> randomRangeLow>' HIGH='<@VAR randomRangeHigh>'>"> >> >> <@! And the winner is... > >> <@VAR resultSet[<@VAR winnerRowIndex>,*]> >> >> >> >> >> Hope this helps. >> >> Eric >> >> _______________________________________________________________________ >> _ >> TO UNSUBSCRIBE: send a plain text/US ASCII email to >> [EMAIL PROTECTED] >> with unsubscribe witango-talk in the message body >> >> > > -- > > Robert Garcia > President - BigHead Technology > CTO - eventpix.com > 2781 N Carlmont Pl > Simi Valley, Ca 93065 > ph: 805.522.8577 - cell: 805.501.1390 > [EMAIL PROTECTED] - [EMAIL PROTECTED] > http://bighead.net/ - http://eventpix.com/ - http://theradmac.com/ > > ________________________________________________________________________ > TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED] > with unsubscribe witango-talk in the message body ________________________________________________________________________ TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED] with unsubscribe witango-talk in the message body