Print Page | Close Window

How do I make this sort correctly?

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=5818
Printed Date: 19 September 2024 at 5:41pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How do I make this sort correctly?
Posted By: idolpx
Subject: How do I make this sort correctly?
Date Posted: 17 December 2006 at 3:36pm
I need it to sort as a number. but it's doing a text sort.



I thought there was a SortAsNumber property for the Column object but I guess I was wrong.

Any ideas?




Replies:
Posted By: Oleg
Date Posted: 17 December 2006 at 3:56pm
Hi,
I think you have to set Item.Value as Single and set Format property to "$%s" to automatically add "$" - it will increase perfomance of sorting and will sort in right order.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: idolpx
Date Posted: 17 December 2006 at 4:16pm
Perfect!  That did the trick.  :)

Thanks!


Posted By: LittleJK
Date Posted: 05 February 2007 at 12:01pm
Quick Question how would you sort on a date field where it's grouped? We have a date field that is being already formated to capture the time and then split out the date.

 Set RecordItem = .AddItem(CDate(CheckForNull(rs.Fields("d_datemade"))))
            RecordItem.Format = "%I:%M %p"
            RecordItem.GroupCaption = Format$(CheckForNull(rs.Fields("d_datemade")), "mm/dd/yyyy")

The issue is that when we group by the date, we want it to be sorted in order based upon the most recent time. Due to that it's interpreting the group line as text, 1/1/06 would come before 1/1/07 when in all actuality 1/1/07 should be coming first. We didn't notice this due to if it's the same year the month and day would make it seem to appear to being sorted correctly.


Posted By: sserge
Date Posted: 06 February 2007 at 5:00pm
Originally posted by LittleJK LittleJK wrote:

Quick Question how would you sort on a date field where it's grouped? We have a date field that is being already formated to capture the time and then split out the date.

 Set RecordItem = .AddItem(CDate(CheckForNull(rs.Fields("d_datemade"))))
            RecordItem.Format = "%I:%M %p"
            RecordItem.GroupCaption = Format$(CheckForNull(rs.Fields("d_datemade")), "mm/dd/yyyy")

The issue is that when we group by the date, we want it to be sorted in order based upon the most recent time. Due to that it's interpreting the group line as text, 1/1/06 would come before 1/1/07 when in all actuality 1/1/07 should be coming first. We didn't notice this due to if it's the same year the month and day would make it seem to appear to being sorted correctly.


If you set cell values not as a text, but as OLE Variant values (native COM date/time) -- it will be both sorted and grouped correctly.

--
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