Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - How do I make this sort correctly?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How do I make this sort correctly?

 Post Reply Post Reply
Author
Message
idolpx View Drop Down
Newbie
Newbie


Joined: 24 February 2005
Status: Offline
Points: 20
Post Options Post Options   Thanks (0) Thanks(0)   Quote idolpx Quote  Post ReplyReply Direct Link To This Post Topic: How do I make this sort correctly?
    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?

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
idolpx View Drop Down
Newbie
Newbie


Joined: 24 February 2005
Status: Offline
Points: 20
Post Options Post Options   Thanks (0) Thanks(0)   Quote idolpx Quote  Post ReplyReply Direct Link To This Post Posted: 17 December 2006 at 4:16pm
Perfect!  That did the trick.  :)

Thanks!
Back to Top
LittleJK View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 April 2006
Status: Offline
Points: 168
Post Options Post Options   Thanks (0) Thanks(0)   Quote LittleJK Quote  Post ReplyReply Direct Link To This Post 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.
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: 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
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.