[thelist] sorting recordset problems

Asif Suria asifsuria at yahoo.com
Wed Jan 4 15:42:56 CST 2006


Ron,

This is an interesting problem indeed. If the month is
always characters 4 to 6 then I have a solution that
will fix half of your problem. 

Create a new table called something like
month_id(month_name, id) and populate with values like


month_name    id
Jan           1
Feb           2
Mar           3
Apr           4

Now a SQL statement like the following will sort the
files by month.

SELECT d.crazydate
FROM date_test d, month_id m
WHERE m.month_name = RIGHT(LEFT(d.crazydate, 6), 3)
ORDER BY m.id

The date part could be solved with a similar approach
I think. Will let you know if I figure it out.


--- "Pringle, Ron" <RPringle at aurora-il.org> wrote:

> Hello all-
> 
> Using classic ASP/VBScript, I've created a recordset
> using FileSystemObject
> to grab a listing of PDFs from a directory. All is
> well and good, except I
> need to sort the resulting records by part of the
> file name, specifically
> the month and day, which are written in the middle
> of the file.
> 
> An example file name is: ctyJan122005agd.pdf
> 
> I need to sort by Month (most recent month first)
> and then by day. So if I
> had two records with the names as below, they would
> sort with the June one
> first:
> 
> ctyJun232005agd.pdf
> ctyJan122005agd.pdf
> 
> Right now, all I do is create a recordset with one
> field called "name" which
> holds the file name, and I sort it by Ascending.
> Obviously doesn't give me
> the results I want.
> 
> Not adding the files to a recordset and simply
> outputting them via a loop
> just gives me the files in whatever order they
> appear in the directory.
> 
> Any ideas or links to further reading? Not sure what
> to even Google for to
> get an answer to this one.
> 
> Regards,
> Ron
> -- 
> 
> * * Please support the community that supports you. 
> * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip
> Harvester 
> and archives of thelist go to:
> http://lists.evolt.org 
> Workers of the Web, evolt ! 
> 


--------------------------------------------
Blog -> http://www.sinletter.com/ablog.aspx
--------------------------------------------


		
__________________________________________ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 




More information about the thelist mailing list