Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Date Sorting Problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Date Sorting Problem

 Post Reply Post Reply
Author
Message
rob@shuksan.com View Drop Down
Newbie
Newbie


Joined: 04 September 2007
Location: United States
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote rob@shuksan.com Quote  Post ReplyReply Direct Link To This Post Topic: Date Sorting Problem
    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.
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
albrecht View Drop Down
Newbie
Newbie


Joined: 09 November 2007
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote albrecht Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.