Print Page | Close Window

Date Sorting Problem

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=7983
Printed Date: 28 September 2024 at 6:12pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Date Sorting Problem
Posted By: rob@shuksan.com
Subject: Date Sorting Problem
Date Posted: 12 September 2007 at 11:39am
I am looking for a way to properly sort a report column by date. I need the column to sort in descending order where the most recent date is on top.
 
wndReportControl.SortOrder.Add wndReportControl.Columns(COLUMN_SENT)
wndReportControl.SortOrder(0).SortAscending = False
wndReportControl.Populate
 
The results come out as such:
 
9/3/2007 9:31 PM
9/11/2007 8:48 PM
9/1/2007 6:46 AM
 
Any help would be appreciated. Thx.



Replies:
Posted By: sserge
Date Posted: 23 September 2007 at 5:12pm
The control will sort date/time columns automatically, but you have to properly set Value of corresponding items.

It looks for me that you sent a datetime value as a simple String, and it is sorted using String comparison rules.

--
WBR,
Serge


Posted By: albrecht
Date Posted: 09 November 2007 at 3:33pm
I have the sam problem,
tried to add a date value to an item
(as string and as date) but
sorting by date doesn't correct sort
could this be because of the windows
language setting?
 
I have also the Problem if I have a Size Column
with mixed SizeValues (xx KB, yy MB, ...) the sorting
is always alphabetic not numeric...
 
so I also hope for help :-)
 
regards


Posted By: sserge
Date Posted: 19 November 2007 at 6:01pm
Originally posted by albrecht albrecht wrote:

I have also the Problem if I have a Size Column
with mixed SizeValues (xx KB, yy MB, ...) the sorting
is always alphabetic not numeric...


Well, when .Value property is available -- it sorts using it's Variant value (which may be numeric, date or anything else).

Otherwise it sorts by text strings.

It depends on how do you initialize items in your code.

--
WBR,
Serge



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net