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

Sorting dates

 Post Reply Post Reply
Author
Message
CapoPezzio View Drop Down
Groupie
Groupie


Joined: 13 April 2010
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote CapoPezzio Quote  Post ReplyReply Direct Link To This Post Topic: Sorting dates
    Posted: 07 September 2010 at 7:30am
I am using Reportcontrol and give it a recordset and uses databind.

My database have dateformat dd.mm.yyyy and I want to show it that way. That works fine, but when I sort on a date-column it is not correct.

it shows

01.01.2007
01.01.2008
02.01.2007
02.03.2008
02.04.2007


My workaround at the moment is afters Databind I go through every dateitem in the Reportcontrol and set the caption-property to show dd.mm.yyyy format an set the value-property to yyyymmdd-format. This way it shows correct and it sorts correct. But I thought this was going to work with no workaround. Any idea?

Product: Xtreme SuitePro (ActiveX) version 13.3.1
Platform: Windows 7 (32bit)
Language: Visual Basic 6.0
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 13 September 2010 at 9:59am
Hi,
 
If I add an item as Date it will sorted as date so (don't know for sure...) I don't think DataBind feature supports types yet ????
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
CapoPezzio View Drop Down
Groupie
Groupie


Joined: 13 April 2010
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote CapoPezzio Quote  Post ReplyReply Direct Link To This Post Posted: 21 September 2010 at 5:20am
Hi. I dont find a way to set the types of my columns when I use Databind. Anyone know if there is a way to set the type (ie Date) on all the data in a Column when I use Databind, so my sorting will work. Now I have to go through every dateitems in every rows and set the format manually. I have 3 date-columns and when I have 200000 records in my grid it takes 10 seconds(wich in my world is agesSmile), just to set the dates right so the sorting will work.
Product: Xtreme SuitePro (ActiveX) version 13.3.1
Platform: Windows 7 (32bit)
Language: Visual Basic 6.0
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 21 September 2010 at 5:57am
Hi,
 
I tried with CJ sample and it actually sorts date/time values...
 
Can you upload small test project?
 
Thanks
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
CapoPezzio View Drop Down
Groupie
Groupie


Joined: 13 April 2010
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote CapoPezzio Quote  Post ReplyReply Direct Link To This Post Posted: 21 September 2010 at 8:35am
Thanks for your interest Aaron. But I think I found my problem. There were some old code wich "converted" my sql, my date-columns where converted in the sql-statement... select col1,col2 ,convert(varchar(24),col3,104) from....

..wich resultet in my recordset(and ReportControl) treated my date-column as text, and therefore sorted it as text.
Removed the old code in the sql-statement and did the formating in RC_BeforeDrawRow. It did wonder.

Private Sub RC_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)
   if item.index = index_of_datecol
      item.format = "%d.%m.%Y"
      Metrics.Text = item.Caption
    end if
 
End Sub

did this because my date-columns contains date and time and I only wanted to show date
Product: Xtreme SuitePro (ActiveX) version 13.3.1
Platform: Windows 7 (32bit)
Language: Visual Basic 6.0
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.141 seconds.