Re: Randomize Query results?

2009-10-13 Thread Dave Watts
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

Re: Randomize Query results?

2009-10-13 Thread Barney Boisvert
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

RE: Randomize Query results?

2009-10-13 Thread Paul Vernon
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)]

Re: Randomize Query results?

2009-10-13 Thread Rick Root
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

Re: randomize

2005-03-25 Thread Barney Boisvert
Like pick one record at random, or display all 50 in a random order? I'm thinking the latter? Here's an idea. Not optimized for speed, or even tested to run properly. cfset rows = arrayNew(1) / cfloop query=myQuery cfset arrayAppend(rows, currentRow) / /cfloop cfloop

RE: randomize

2005-03-25 Thread CFDEV
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

RE: randomize

2005-03-25 Thread Adrian Lynch
If you're using SQL Server, try doing the randomising in the query. SELECT * FROM yourTable ORDER BY NEWID() There's also something like this in mySQL and no doubt other DBs. Ade -Original Message- From: CFDEV [mailto:[EMAIL PROTECTED] Sent: 25 March 2005 17:32 To: CF-Talk Subject:

Re: randomize

2005-03-25 Thread Sam Farmer
How about: #queryName.questID[randRange(1,queryName.recordCount)]# Haven't tested it so the randRange may need to be pulled out and set to a variable. Cheers, Sam On Fri, 25 Mar 2005 12:31:51 -0500, CFDEV [EMAIL PROTECTED] wrote: Hi, I have a query and i want to display the results

Re: randomize()

2004-01-26 Thread Christian Cantrell
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]

RE: randomize()

2004-01-26 Thread Tony Weeg
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

RE: randomize()

2004-01-26 Thread Tony Weeg
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

Re: randomize()

2004-01-26 Thread Christian Cantrell
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)/

RE: randomize()

2004-01-23 Thread Samuel R. Neff
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,

Re: randomize()

2004-01-23 Thread Jim McAtee
Both.RandRange() takes exact the same numbers that would be generated by Rand(), normally betwee 0 and 1 and scales (and offsets) them into the integer range you specify. - Original Message - From: Tony Weeg [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, January 23, 2004

RE: randomize()

2004-01-23 Thread Tony Weeg
:[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

Re: Randomize

2000-11-27 Thread paul smith
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: "paul smith" [EMAIL

RE: Randomize

2000-11-27 Thread Dave Watts
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) 797-5496

RE: Randomize

2000-11-27 Thread paul smith
It turns out the problem was the way I generated OrderID. I had used: CFSET OrderID = DateFormat(Now(), "mmdd") TimeFormat(Now(), "hhmmss") RandRange(1000,) which worked for CFAS 4.01 but not for CFAS 4.5.1. It dawned on me how to modify my error trapping and I was able to see that