I actually had to just accomplish something similar to this last week,
but I had to sort just a subset of a main query, basically just sort the
N records you were viewing on the screen.  (N is set by user)

I did this by building a new query from the main query but only using
the rows shown:

<!--- Set a variable that can be evaluated as the users query columnlist
--->
<cfset qry_cols = Evaluate(query_name & '.columnlist')>
        
<!--- Build a new query, getdata,  limited to just the records we want
on that page --->
<cfset getdata = queryNew(qry_cols)>
<cfoutput query="#query_name#" startrow="#start_row#"
maxrows="#NumRowsDisplay#">
        <cfset tmp = queryAddRow(getdata)>
        <cfloop list="#qry_cols#" index="i">
                <cfset CurrField = '#query_name#.' & '#i#'>
                <cfset tmp =
querySetCell(getdata,i,evaluate(CurrField))>
        </cfloop>
</cfoutput>

Then I use a query of query to do the ordering:

<!--- Overwrite new query using query of query with OBC --->
<cfquery name="getdata" dbtype="query">
select * from getdata
MY ORDER BY CLAUSE....
</cfquery>

MY QUESTION:
Now I have been asked to make this work on 4.5.  Anyone know an easy way
of accomplishing this?  
I figure on my original query output I can build a list of what ID's are
displayed on that page, then to sort requery with my Order By clause
where id IN (ID LIST), but was wondering if there was a better way.

Thanks,
Scott


-----Original Message-----
From: Raymond Camden [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 23, 2002 3:01 PM
To: CF-Talk
Subject: RE: Re-Sort a Query...


I'd start with the CFDocs. I'll echo Charlie Arehart and say this is a
wonderful place to begin with _all_ your CF skills. Next, go to the
Resources page on www.cflib.org - we have links to articles on UDF usage
that should help.

=======================================================================
Raymond Camden, ColdFusion Jedi Master for Hire

Email    : [EMAIL PROTECTED]
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: Brian Scandale [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 23, 2002 3:54 PM
> To: CF-Talk
> Subject: RE: Re-Sort a Query...
> 
> 
> That UDF looks direct and to the point...
> 
> I'd love to use it. Can you provide a hint or two to get me
> started on using UDF's ... where they go ... how they are 
> installed ... etc?
> 
> Thanks
> Brian
> 
> At 12:39 PM 9/23/02, you wrote:
> >If you are using CF5 or higher, you can use QofQ. If you are
> using MX,
> >I've even got a UDF for it...
> >
> ><cfset query = querySort(query,"new column to sort by")>
> >
> >=============================================================
> ==========
> >Raymond Camden, ColdFusion Jedi Master for Hire
> >
> >Email    : [EMAIL PROTECTED]
> >Yahoo IM : morpheus
> >
> >"My ally is the Force, and a powerful ally it is." - Yoda
> >
> >> -----Original Message-----
> >> From: Brian Scandale [mailto:[EMAIL PROTECTED]]
> >> Sent: Monday, September 23, 2002 3:33 PM
> >> To: CF-Talk
> >> Subject: Re-Sort a Query...
> >> 
> >> 
> >> I want to Re-Sort a Query that I have added several columns
> >> of data to...
> >> It is the new columns that I would like to sort by and I 
> >> can't go back to the database to use it's sorting routines. I 
> >> need to do this in CF.
> >> 
> >> Browsing the docs I'm not seeing anything obvious. Thanks.
> >> 
> >> 
> >> 
> >> At 10:08 AM 9/23/02, you wrote:
> >> >That looks very promising! and jeeze... right under my nose
> >> the whole time. That's embarrassing. Thanks Jochem
> >> >
> >> >At 01:53 AM 9/23/02, you wrote:
> >> >>Brian Scandale wrote:
> >> >>> How do I go about adding a column to a query dataset?
> >> >>
> >> >>QueryAddColumn()?
> >> >>
> >> >>Jochem
> >> >>
> >> >>
> >> >
> >> 
> >
> 

______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to