Print Page | Close Window

Report Control Sorting dates....

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: General Discussion
Forum Description: Topics Related to Active-X COM Development in General
URL: http://forum.codejock.com/forum_posts.asp?TID=1097
Printed Date: 10 May 2024 at 10:01am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Report Control Sorting dates....
Posted By: Jens4
Subject: Report Control Sorting dates....
Date 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




Replies:
Posted By: ianp
Date 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!



Posted By: ianp
Date 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 - 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



Posted By: SuperMario
Date Posted: 23 February 2005 at 1:15pm
The ReportControl is now smart enought to sort by date with no work arounds.



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