Tips and Tricks
 Crystal Reports Forum : Crystal Reports .NET 2003 : Tips and Tricks
Message Icon Topic: Sorting of datetime field is not working Post Reply Post New Topic
Author Message
DDSJ
Newbie
Newbie


Joined: 18 Aug 2021
Online Status: Offline
Posts: 12
Quote DDSJ Replybullet Topic: Sorting of datetime field is not working
    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
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet 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.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet 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.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

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



This page was generated in 0.032 seconds.