The Coldfusion Open Source Forums
Home | ImageCFC | CFFM | BlogCFM | CFMBB | CFOpenMail / ImapCFC | CFOpenChat
Forums | Profile | Inbox | Members | Chat | Search | Login | RSS
Vivio Technologies VPS Hosting
New Topic Reply Subscription Options   Previous Page  Page: 1   Previous Page

Forums: CFFM: Change directory sort order to work
Created on: 06/27/07 {ts '2013-05-20 04:39:00'} Views: 7247 Replies: 9
Change directory sort order to work with numbers
Posted Wednesday, June 27, 2007 at {ts '2013-05-20 04:39:00'}

Hello, I have directories that are represented by numbers. Trouble is that default sort order does not work well with that - I get 1,10,11,2,22,23,3,4,5 instead of 1,2,3,4,5,10,11,22,23 as an example. Is there a way to change the sort order?

RE: Change directory sort order to work
Posted Wednesday, June 27, 2007 at {ts '2013-05-20 07:58:00'}

I'm not sure that can be done. The sorting is done by CF in a query of queries, and I don't think there's any way to change coldfusion's alphabetical sort ...

I'll ask around at CFUNITED today...

RE: Change directory sort order to work
Posted Wednesday, June 27, 2007 at {ts '2013-05-20 18:28:00'}

Thank you

RE: Change directory sort order to work
Posted Friday, June 29, 2007 at {ts '2013-05-20 12:32:00'}

I may have found a custom tag cf_querysort (has type="numeric" which looks like a change of sort order from ASC to "Text nocase") that will allow me to do this, but I can't figure out where is the directory listing query/output in the source. Can you help with location?

RE: Change directory sort order to work
Posted Wednesday, July 18, 2007 at {ts '2013-05-20 15:17:00'}

Anyone...?

RE: Change directory sort order to work
Posted Wednesday, July 18, 2007 at {ts '2013-05-20 16:12:00'}

Check out line 983 of cffm.cfm

<cfquery name="sortedDirList" dbtype="query">
select *, lower(name) as sortname
from variables.dirlist
order by type, sortname
</cfquery>

Rick Root
I'm not certified, but I have been told that I'm certifiable!

www
RE: Change directory sort order to work
Posted Friday, August 17, 2007 at {ts '2013-05-20 11:15:00'}

Rick,

First off, great application you've written here - can't begin to say how useful it's been to me.

We just upgraded to BlueDragon 7.0 and CFFM 1.13's sort direction now defaults to what appears to be size - I tried changing the query above you mentioned to just "sortname", but no effect. Any ideas?

Any help is greatly appreciated.

RE: Change directory sort order to work
Posted Friday, August 17, 2007 at {ts '2013-05-20 13:53:00'}

Apparently BlueDragon 7 doesn't like column names aliased in this manner - we solved it by directly referencing the column name (not the alias) in the order by clause:



<cfquery name="sortedDirList" dbtype="query">
   select *, lower(name) as sortname
   from variables.dirlist
   order by type, name
</cfquery>

RE: Change directory sort order to work
Posted Saturday, August 18, 2007 at {ts '2013-05-20 23:47:00'}

Interesting.

But that still doesn't solve your problem, does it? It still does an alpha sort...

Rick Root
I'm not certified, but I have been told that I'm certifiable!

www
RE: Change directory sort order to work
Posted Saturday, August 18, 2007 at {ts '2013-05-20 23:48:00'}

Heh, I see you weren't the original poster.. no word if that cf_querysort solved his/her problem.

Rick Root
I'm not certified, but I have been told that I'm certifiable!

www

New Topic Reply Subscription Options   Previous Page  Page: 1   Previous Page
Subscription Options
Subscription options are available after you log in.

There are 3 active user sessions right now.