Forums
 This topic is locked 
             Date Sorting in a Recordset
 14 Mar 2001  12:54:52 Aaron Jay posted: 
 I am building an online timesheet for internal use, and i want to display a timesheet, but display the records by the week. How would I sort and order my details from Monday to Sunday, and have it based on the current week?  I would guess that the work is mostly done in the recordset, but I don't think it can be done within the realm of Ultradev.  Will this take some custom scripting?Replies
 Replied 14 Mar 2001  23:32:13 
   14 Mar 2001  23:32:13 George Petrov replied: 
  The sort on date parts (week, day of the week) is usually done in the SQL query.
So when you have a Recordset in UD - you should go to advanced view, and change manually the query to contain some date sorting functions like DATEPART
For example:
SELECT ... WHERE ... ORDER BY DATEPART(wk,date_field) ASC
will sort your records asceinding by week number
Look at msdn.microsoft.com for more info on the DATEPART function.
Greetings,
George Petrov
www.UDzone.com
  So when you have a Recordset in UD - you should go to advanced view, and change manually the query to contain some date sorting functions like DATEPART
For example:
SELECT ... WHERE ... ORDER BY DATEPART(wk,date_field) ASC
will sort your records asceinding by week number
Look at msdn.microsoft.com for more info on the DATEPART function.
Greetings,
George Petrov
www.UDzone.com
