Or maybe more efficient if you read the file through cfhttp:
- read it in a query
- add a column formattedDate to the query
- loop over the query and insert DateFormat(query.date,"yyyy-mm-dd") in
the new column
- use QofQ to reorder the query (as below)
- if necessary, recreate the file from the query

> -----Original Message-----
> From: Pascal Peters
> Sent: woensdag 30 juni 2004 16:40
> To: CF-Talk
> Subject: RE: Sorting help!
>
> I misread your original post, so this should do it (adapted
> from previous version):
>  
> <!--- Supposing txt is your file, acctno is digits only and
> dates are in mm-dd-yyyy format ---> <cfset qLines =
> QueryNew("line,acctno,date")> <cfloop list="#txt#"
> delimiters="#chr(10)##chr(13)#" item="line">
> <cfscript>
> stTmp = REFind("^(\d+),(\d+)-(\d+)-(\d+),",line,1,true);
> acctno = Mid(line,stTmp.pos[2],stTmp.pos[2]);
> date =  Mid(line,stTmp.pos[5],stTmp.pos[5]) & "-" &
> Mid(line,stTmp.pos[3],stTmp.pos[3]) & "-" &
> Mid(line,stTmp.pos[4],stTmp.pos[4]);
> QueryAddRow(qLines);
> QuerySetCell(qLines,"line",line);
> QuerySetCell(qLines,"acctno",acctno);
> QuerySetCell(qLines,"date",date);
> </cfscript>
> </cfloop>
> <cfquery dbtype="query" name="qLinesSorted"> SELECT line FROM
> qLines ORDER BY acctno, date DESC </cfquery> <cfset newtxt =
> ""> <cfoutput query="qLinesSorted">
>   <cfset newtxt = newtxt & qLinesSorted.line & chr(10)> </cfoutput>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to