Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > General Discussion
  New Posts New Posts RSS Feed - Report Control Sorting dates....
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Report Control Sorting dates....

 Post Reply Post Reply
Author
Message
Jens4 View Drop Down
Groupie
Groupie
Avatar

Joined: 11 June 2004
Location: Denmark
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jens4 Quote  Post ReplyReply Direct Link To This Post Topic: Report Control Sorting dates....
    Posted: 21 August 2004 at 11:19am

I have studing you reportcontrol sample, but cant figure out how the control trying to sort the dates columns .... maybe it is because my windows use the date format dd-mm-yyyy (danish), that sample just does't sort the dates columns in a right way....

anybody have a small small samples that can sort a date column correctly.... (is has to work with at data and a time)

Kind regards

Jens

Back to Top
ianp View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 19 December 2003
Location: United Kingdom
Status: Offline
Points: 119
Post Options Post Options   Thanks (0) Thanks(0)   Quote ianp Quote  Post ReplyReply Direct Link To This Post Posted: 22 August 2004 at 4:39am

One solution I've found is to populate the SortPriority with the numeric value of the date e.g.   

If IsDate(val)
    Item.Value = Format(val, "ddd dd/mm/yyyy")
    Item.SortPriority = val
Else
    Item.Value = val
End if


However, since the SortPriority is a Long, this method doesn't cater for the time portion of a date/time value!

Back to Top
ianp View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 19 December 2003
Location: United Kingdom
Status: Offline
Points: 119
Post Options Post Options   Thanks (0) Thanks(0)   Quote ianp Quote  Post ReplyReply Direct Link To This Post Posted: 02 September 2004 at 10:14am

Another solution, which Maui found (see https://forum.codejock.com/forum_posts.asp?TID=1119& PN=1#2921) is to set the Value to the date/number, then set the caption to the formatted value, which leaves the sortpriority free to be used as intended.

e.g.

Item.Value = val
If IsDate(Item.Value)
    Item.Caption = Format(val, "ddd dd/mm/yyyy")
ElseIf IsNumeric(Item.Value)
    Item.Caption = Format(val, "#,##0.00")
Else
    Item.Caption = Item.Value
End if



Edited by ianp
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 23 February 2005 at 1:15pm
The ReportControl is now smart enought to sort by date with no work arounds.
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.188 seconds.