I have a Query of Query right now that I'd like to have the results sort order
randomized. Any ideas? I've seen examples dependent on the dbms for
producing a random randomization, but is there any way to do that within QofQ?
The base query that my QoQ is operating on is a cached Oracle
I have a Query of Query right now that I'd like to have the results sort
order randomized. Any ideas? I've seen examples
dependent on the dbms for producing a random randomization, but is there any
way to do that within QofQ? The base query that
my QoQ is operating on is a cached
If you're picking one item from a query, you can just do:
myQuery.myColumn[randRange(1, myQuery.recordCount)]
That'll be way more efficient than reordering the whole query.
cheers,
barneyb
On Tue, Oct 13, 2009 at 2:53 PM, Yuliang Ruan yuliangr...@hotmail.com wrote:
I have a Query of Query
Also brainstorming for other alternatives. It's a simple round robin
load balancer. I'd rather not have the first unit just by database
index order selected all the time.
This is what I did...
VacancyID is a primary key...
cfset theVacancyID = q.VacancyID[RandRange(1, q.recordcount)]
What about adding a blank column to your query results
select '' as foo, othercols
from table
cfloop query=qry
cfset querySetCell(qry,foo,rand(),currentrow
/cfloop
and then
select * from qry
order by foo
Maybe something like that would work.
Rick
Hi,
I have a query and i want to display the results randomize at each load of
the page.
query :
select questID from quest order by questID
There is 50 questID.
I'm under CF5 for this one.
Thanks
Pat
~|
Discover
randomize at each load of
the page.
query :
select questID from quest order by questID
There is 50 questID.
I'm under CF5 for this one.
Thanks
Pat
--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/
Got Gmail? I have 50 invites
Great thanks Barny, it works great and performance is perfect
Pat
-Original Message-
From: Barney Boisvert [mailto:[EMAIL PROTECTED]
Sent: March 25, 2005 12:56
To: CF-Talk
Subject: Re: randomize
Like pick one record at random, or display all 50 in a random order?
I'm thinking
: randomize
Hi,
I have a query and i want to display the results randomize at each load of
the page.
query :
select questID from quest order by questID
There is 50 questID.
I'm under CF5 for this one.
Thanks
Pat
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus
randomize at each load of
the page.
query :
select questID from quest order by questID
There is 50 questID.
I'm under CF5 for this one.
Thanks
Pat
~|
Logware (www.logware.us): a new and convenient web-based time
On Friday, January 23, 2004, at 03:24PM, Tony Weeg wrote:
does randomize do anything for randRange(), or ONLY for rand()
Here's a lot more information than you probably wanted to know:
http://www.markme.com/cantrell/archives/004256.cfm
Christian
[Todays Threads]
[This Message
excellent christian.
thanks.
tony
-Original Message-
From: Christian Cantrell [mailto:[EMAIL PROTECTED]
Sent: Monday, January 26, 2004 10:25 AM
To: CF-Talk
Subject: Re: randomize()
On Friday, January 23, 2004, at 03:24PM, Tony Weeg wrote:
does randomize do anything for randRange
so do you hardcode your min/max at the top of the cfc?
you don't pass them in right?
tony
-Original Message-
From: Tony Weeg [mailto:[EMAIL PROTECTED]
Sent: Monday, January 26, 2004 10:41 AM
To: CF-Talk
Subject: RE: randomize()
excellent christian.
thanks.
tony
-Original
They should be passed in.The hardcoded zeros are defaults which
actually result in the next() function returning any number within the
range of an integer.The component is meant to be used like this:
cfset rng = createObject(component, com.macromedia.util.Random)/
cfset rng.setBounds(1, 52)/
does randomize do anything for randRange(), or ONLY for rand()
thanks.
...tony
tony weeg
senior web applications architect
navtrak, inc.
www.navtrak.net
[EMAIL PROTECTED]
410.548.2337
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
When either rand() or randRange() is used for the first time in a request, a
random number generator is instantiated using the value of getTickCount() as
the seed.This same random number generator is used for all rand(),
randRange(), and randomize() calls for the remainder of the request.
So
:24 PM
Subject: randomize()
does randomize do anything for randRange(), or ONLY for rand()
thanks.
...tony
tony weeg
senior web applications architect
navtrak, inc.
www.navtrak.net
[EMAIL PROTECTED]
410.548.2337
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe
:[EMAIL PROTECTED]
Sent: Friday, January 23, 2004 6:18 PM
To: CF-Talk
Subject: RE: randomize()
When either rand() or randRange() is used for the first time in a
request, a random number generator is instantiated using the value of
getTickCount() as the seed.This same random number generator is used
Hi folks,
We suddenly encountered an interesting problem with using GetTickCount() to initialize
random number generation. We have this line of code at the top of many files that
endeavour to use random numbers:
cfset Randomize(GetTickCount())
GetTickCount() returns a different number every
yup, you need to shrink the number used in the Randomize function to less than the
size of an integer. Try taking the Right() of getTickCount() or dividing/subracting
it by a large number to reduce its size. I recommend just using the Right() function
or by simply subtracting a larger number
it
and resubscribe if you want to get this info THANK YOU... I'll give you
one day to get this message then delete the account.
- Original Message -
From: Mike Mertsock [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Friday, August 08, 2003 8:59 PM
Subject: using Randomize(GetTickCount
The following works in CFAS 4.01 but not CFAS 4.51:
CFSET TMP = Randomize(OrderID)
Changing to:
CFSET TMP = Randomize("#OrderID#")
is no help.
Any suggestions?
best, paul
~~
Structure your ColdFusion code with Fusebox. Get the off
Yep! CFAS 4.5.1 also pukes on Randomize("OrderID").
best, paul
At 03:33 PM 11/27/00 -0500, you wrote:
Have you tried putting quotation marks around OrderID without the # signs?
e.g. CFSET TMP = Randomize("OrderID")
- - - Jeanne
- Original Message -
From:
The following works in CFAS 4.01 but not CFAS 4.51:
CFSET TMP = Randomize(OrderID)
Changing to:
CFSET TMP = Randomize("#OrderID#")
What error does it return? That code works fine for me on CF 4.5.1 SP2.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202
nd I was able to see that CFAS 4.5.1 said OrderID
generated as above was not an integer.
Switching to CFSET OrderID = TimeFormat(Now(), "hhmmss")
worked fine.
best, paul
At 04:48 PM 11/27/00 -0500, you wrote:
The following works in CFAS 4.01 but not CFAS 4.51:
CFSET TMP = R
25 matches
Mail list logo