RE: Randomization of a cfquery

2002-12-21 Thread Steve Dworman
I guess a simple solution would be to use the rand() function for the range of 1 - queryname.recordcount. Run a loop (queryname.recordcount times) and generate the random list of integers. use your randomized list and match up each value with the queryname.currentrow variable (cfquery), and voila

RE: Randomization of a cfquery

2002-12-21 Thread Joe Eugene
Dave, If i understand.. your question right... this is quite simple. #queryName.FieldName[i]# The above will give you random records...one at a time. if you want all the records to be random each time.. you might want to put indexes in an array.. and re-arrange them and just use array notatio

Re: Randomization of a cfquery

2002-12-21 Thread Christian Cantrell
It's not as easy as it seems. Here's a function that I believe will do the trick. I wrote it pretty quickly, so if you are going to use it, test it thoroughly. Just pass in a query object and it will return a new query object with the rows randomized. You can wrap it in a custom tag if

Re: Randomization of a cfquery

2002-12-22 Thread Peter Mayer
http://www.cflib.org/udf.cfm?ID=524 Returns a query object with a specified number of random records from the passed query. Some code based on QuerySlice() by Kevin Bridges ([EMAIL PROTECTED]) Best regards, Peter Orginale Nachricht Von: "David Jones" <[EMAIL PROTECTED]> Betreff

RE: Randomization of a cfquery

2002-12-22 Thread Joe Eugene
]# . #queryName.ColumnName[aIdx[k]]# -Original Message- > From: Christian Cantrell [mailto:[EMAIL PROTECTED]] > Sent: Saturday, December 21, 2002 9:39 PM > To: CF-Talk > Subject: Re: Randomization of a cfquery > > > It's not as easy as it seems. Here's a functi

Re: Randomization of a cfquery

2002-12-22 Thread Christian Cantrell
(1,queryName.recordCount); > } > > > > #aIdx[k]# . #queryName.ColumnName[aIdx[k]]# > > > Joe > >> -Original Message- >> From: Christian Cantrell [mailto:[EMAIL PROTECTED]] >> Sent: Saturday, December 21, 2002 9:39 PM >> To: CF-Talk >&

RE: Randomization of a cfquery

2002-12-22 Thread David Jones
This function seems to be working beautifully. Thank you. Dave -Original Message- From: Christian Cantrell [mailto:[EMAIL PROTECTED]] Sent: Saturday, December 21, 2002 9:39 PM To: CF-Talk Subject: Re: Randomization of a cfquery It's not as easy as it seems. Here's a funct

Re: Randomization of a cfquery

2002-12-23 Thread Joe Eugene
gt; > } > > > > > > > > #aIdx[k]# . #queryName.ColumnName[aIdx[k]]# > > > > > > Joe > > > >> -Original Message- > >> From: Christian Cantrell > [mailto:[EMAIL PROTECTED]] > >> Sent: Saturday, December 21, 20