I believe your code will break if you have a field that contains "desc"
in it. Better to split again on a space to determine sort order. You
would need to do something like this (off the top of my head, so it
isn't tested):
<cfset order="asc">
<cfif (listlen(x, " ") eq 2)>
<cfset order=listgetat(x, 2, " ")>
</cfif>
<cfswitch expression="#order#">
<cfcase value="asc">
<cfset query.getOrder().setAsc(zzz)>
</cfcase>
<cfcase value="desc">
<cfset query.getOrder().setDesc(zzz)>
</cfcase>
<cfdefaultcase>
<cfthrow message="You specified an invalid order">
</cfdefaultcase>
</cfswitch>
Mark
Baz wrote:
*I replaced the following code:*
<cfloop list="#arguments.sortByFieldList#" index="x">
<cfset Query.getOrder().setAsc("<xsl:value-of
select="object/@name" />", trim(x)) />
</cfloop>
*With this:*
<cfloop list="#arguments.sortByFieldList#" index="x">
<cfif findnocase(' desc',x)>
<cfset Query.getOrder().setDesc("<xsl:value-of
select="object/@name" />", trim(replacenocase(x,' desc',''))) />
<cfelse>
<cfset Query.getOrder().setAsc("<xsl:value-of
select="object/@name" />", trim(replacenocase(x,' asc',''))) />
</cfif>
</cfloop>
======================
Depends on what the source looks like.
=======================
I added a couple of lines to /Reactor/xsl/gateway.project.xsl and now my
sortByFieldList processes asc/desc! There doesn't seem to be any
drawback to
what I did. Perhaps it works its way into Reactor?
Baz
-- 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/