Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Even when this question is already solved I want to add, that you could also use the underlying Java method sort(), which is just needing one line and you don't need to add a UDF for this. The code would then look like this:</p> <pre><code>&lt;cfset qQuery.sort(qQuery.findColumn("nameOfSortColumn"), TRUE)&gt; </code></pre> <p>The findColumn() call is needed to get the index of the sort column, because sort() is working with the column indexes and not with the column names. The second parameter specifies the sort order: TRUE = ascending, FALSE = descending.</p> <p>Advantages: one-line call, faster than QoQ</p> <p>Disadvantage: sort restricted to one column</p> <p>There are much more hidden features of the underlying Java class. See the following links for more information:</p> <ul> <li><a href="http://www.zrinity.com/developers/mx/undocumentation/query.cfm" rel="nofollow noreferrer">http://www.zrinity.com/developers/mx/undocumentation/query.cfm</a></li> <li><a href="http://www.anujgakhar.com/2008/02/01/cfquery-and-the-underlying-java-objects/" rel="nofollow noreferrer">www.anujgakhar.com/2008/02/01/cfquery-and-the-underlying-java-objects/</a></li> <li><a href="http://www.bennadel.com/blog/204-Using-ColdFusion-Query-s-Underlying-Java-Methods-For-Query-Manipulation-And-Logic.htm" rel="nofollow noreferrer">www.bennadel.com/blog/204-Using-ColdFusion-Query-s-Underlying-Java-Methods-For-Query-Manipulation-And-Logic.htm</a></li> </ul> <p>In Lucee (tested with 4.5 and 5.2) this also works similar, and even simpler:</p> <pre><code>&lt;cfset qQuery.sort("nameOfSortColumn", "asc")&gt; </code></pre> <p>Hope, this gives some ideas...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload