Print Page | Close Window

Sorting of datetime field is not working

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=23017
Printed Date: 29 Apr 2024 at 2:13am


Topic: Sorting of datetime field is not working
Posted By: DDSJ
Subject: Sorting of datetime field is not working
Date Posted: 05 Sep 2022 at 4:18am
I have a datetime field in report which have time values (ascending order) like :
00:01:00,07:00:00, 13:01:00, 14:00:19
I have applied the ascending sorting in the report using record sort on this field but records are displayed in below manner:

07:00:00, 13:01:00, 14:00:19,00:01:00

The 00:01:00 value field is always displayed in last instead of first place.

Do not know why this is happening.

Please help.

Thanks



Replies:
Posted By: lockwelle
Date Posted: 06 Sep 2022 at 5:27pm
DateTime sorting is not as straight forward as you would think.

I always build a group, then I can go into the grouping properties, and for DateTime you need to specify if it is by the day, the week, and a couple of other ways.

Try them out. Most likely it is set for By Week, which I think is the default.

Hopefully, this will get you pointed in the right direction.


Posted By: kevlray
Date Posted: 07 Sep 2022 at 4:25am
The other way is to use formulas and break out the time parts and do sorting/grouping by them. i.e., left(cstr({datetimefield}),2) to get the hours.



Print Page | Close Window