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
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
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
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
]# . #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
(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
>&
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
gt; > }
> >
> >
> >
> > #aIdx[k]# . #queryName.ColumnName[aIdx[k]]#
> >
> >
> > Joe
> >
> >> -Original Message-
> >> From: Christian Cantrell
> [mailto:[EMAIL PROTECTED]]
> >> Sent: Saturday, December 21, 20
8 matches
Mail list logo