Here is how I would do it (not tested)

<!--- Supposing qDir is your query, acctno is digits only and dates are in mm-dd-yyyy format --->
<cfset qFiles = QueryNew("file,acctno,date")>
<cfloop query="qDir">
<cfscript>
file = qDir.name;
stTmp = REFind("^(\d+),(\d+)-(\d+)-(\d+),",file,1,true);
acctno = Mid(file,stTmp.pos[2],stTmp.pos[2]);
date =  Mid(file,stTmp.pos[5],stTmp.pos[5]) & "-" & Mid(file,stTmp.pos[3],stTmp.pos[3]) & "-" & Mid(file,stTmp.pos[4],stTmp.pos[4]);
QueryAddRow(qFiles);
QuerySetCell(qFiles,"file",file);
QuerySetCell(qFiles,"acctno",acctno);
QuerySetCell(qFiles,"date",date);
</cfscript>
</cfloop>
<cfquery dbtype="query" name="qFilesSorted">
SELECT file
FROM qFiles
ORDER BY acctno, date DESC
</cfquery>
<cfoutput query="qFilesSorted">
#qFilesSorted.file#<br/>
</cfoutput>

HTH, Pascal

> -----Original Message-----
> From: Pascal Peters
> Sent: woensdag 30 juni 2004 16:16
> To: CF-Talk
> Subject: RE: Sorting help!
>
> The problem is that the dates are sorted alphabetically. I
> would create a query with acct n�, date in ISO format and
> file and use query of query. I will post some code in 10' or so
>
> Pascal
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to