You either need to do a custom OO reactor query, or resort the results of
generic getall() on the gateway.
I would do the latter, using the magic of java.sql.resultset...



<cfscript>
       Reactor = CreateObject("Component","reactor.reactorFactory
").init("/reactorxml");
       UserGateway = reactor.createGateway("#Session.the_table#");
       qUsers = UserGateway.getAll(sortByFieldList="FIRSTNAME, USERID");
</cfscript>

after getting your incorrectly sorted query try this java magic:

<CFSET columnId = qUsers.findColumn("USERID")>
<CFSET qUsers.sort(columnId, true)>

To flip the sort for asending/desc change the true param passed to sort to
false.

Doug S.



On 3/1/07, Ron Mast <[EMAIL PROTECTED]> wrote:

Yes I want to output the query in a nice table inside a div with an
overflow style. Below works great. Obviously now I want to order by USERID
ASC.

<cfscript>
        Reactor = CreateObject("Component","reactor.reactorFactory
").init("/reactorxml");
        UserGateway = reactor.createGateway("#Session.the_table#");
        qUsers = UserGateway.getAll(sortByFieldList="FIRSTNAME, USERID");
</cfscript>

<table cellspacing="0" cellpadding="0">
<tr bgcolor="#23269E">
        <td><font size="-1" color="#FFFFFF">First Name</font></td>
        <td><font size="-1" color="#FFFFFF">Last Name</font></td>
        <td><font size="-1" color="#FFFFFF">User Id</font></td>
        <td><font size="-1" color="#FFFFFF">Username</font></td>
        <td><font size="-1" color="#FFFFFF">Password</font></td>
        <td><font size="-1" color="#FFFFFF">Date Created</font></td>
</tr>
<tr>
        <td colspan="6">
                <div style="overflow:auto; height:150px; width:750px;">
                        <table cellpadding="0" cellspacing="0"
width="100%">
                        <cfset altBGC = 1>
                        <cfset trueRecCount = 0>
                        <cfoutput query="qUsers">
                                <cfset theBgColor = IIF(altBGC MOD 2,
de("ffffff"),de("DEEBF7"))>
                                <tr bgcolor="#theBgColor#"
onmouseover="MyTDColor(this, true, '#theBgColor#');"
onmouseout="MyTDColor(this, false, '#theBgColor#');" onclick="">
                                        <td width="121"><font
size="-1">#FIRSTNAME#</font></td>
                                        <td width="120"><font
size="-1">#LASTNAME#</font></td>
                                        <td width="88"><font
size="-1">#USERID#</font></td>
                                        <td width="136"><font
size="-1">#USERNAME#</font></td>
                                        <td width="136"><font
size="-1">#PASSWORD#</font></td>
                                        <td width="*"><font
size="-1">#DATECREATED#</font></td>
                                </tr>
                                <cfset altBGC = altBGC + 1>
                                <cfset trueRecCount = trueRecCount + 1>
                        </cfoutput>
                        </table>
                </div>
        </td>
</tr>
</table>



1. What is this suppose to return? <cfreturn UserGateway.getAll() /> and
why the error?

2. I get nothing when I run <cfreturn UserGateway.getByQuery(qUsers) />.
CF template looks like:

<cfset Reactor = 
CreateObject("Component","reactor.reactorFactory").init("/reactorxml")
/>

<cfset UserGateway=Reactor.createGateway("user")/>

<cfset qUsers = UserGateway.createQuery() />

<cfset qUsers.getOrder().setAsc(session.the_table,"FIRSTNAME") />

<!--- <cfreturn qUsers.getAll()/> --->

<cfreturn UserGateway.getByQuery(qUsers) />

I'm puzzled...:(

Ron Mast
Truth Hardware
Webmaster
507-444-4693

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Tom Chiverton
Sent: Thursday, March 01, 2007 8:35 AM
To: [email protected]
Subject: Re: [Reactor for CF] order by ASC instead of DESC

On Thursday 01 Mar 2007, Ron Mast wrote:
> <cfset Reactor = CreateObject("Component",
> "reactor.reactorFactory").init("/reactorxml") />
>
> <cfset UserGateway = reactor.createGateway("#session.the_table#") />
>
> <cfset qUsers = UserGateway.createQuery()>
>
> <cfset qUsers.getOrder().setAsc(session.the_table,"FIRSTNAME")>
>
> <cfreturn qUsers.getAll()/>

<cfreturn UserGateway.getAll() />

or did you want to return the results of the query ?

<cfreturn UserGateway.getByQuery(qUsers) />

--
Tom Chiverton
Helping to authoritatively expedite corporate CEOs
On: http://thefalken.livejournal.com

****************************************************

This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England
and Wales under registered number OC307980 whose registered office address
is at St James's Court Brown Street Manchester M2 2JF.  A list of members is
available for inspection at the registered office. Any reference to a
partner in relation to Halliwells LLP means a member of Halliwells LLP.
Regulated by the Law Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and
may be confidential or legally privileged.  If you are not the addressee you
must not read it and must not use any information contained in nor copy it
nor inform any person other than Halliwells LLP or the addressee of its
existence or contents.  If you have received this email in error please
delete it and notify Halliwells LLP IT Department on 0870 365 8008.

For more information about Halliwells LLP visit www.halliwells.com.



-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --



-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --




-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to