Sorting dates |
Post Reply |
Author | |
CapoPezzio
Groupie Joined: 13 April 2010 Status: Offline Points: 25 |
Post Options
Thanks(0)
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 |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
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.... |
|
CapoPezzio
Groupie Joined: 13 April 2010 Status: Offline Points: 25 |
Post Options
Thanks(0)
|
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 ages), 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 |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
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.... |
|
CapoPezzio
Groupie Joined: 13 April 2010 Status: Offline Points: 25 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |