Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Group by range Post Reply Post New Topic
Author Message
erdem
Newbie
Newbie


Joined: 27 Apr 2010
Online Status: Offline
Posts: 1
Quote erdem Replybullet Topic: Group by range
     Posted: 27 Apr 2010 at 1:57am
Hi All,

I have a data which has a date/time field.

Time                     Value
22.04.2010 08:47    2
22.04.2010 09:01    3
22.04.2010 11:31    3
22.04.2010 12:44    2
22.04.2010 13:00    3
22.04.2010 17:56    4
22.04.2010 20:34    3

In the cross-tab rows I would like to group them by half hour intervals, i.e:
08:00 - 08:30
08:30 - 09:00
09:00 - 09:30 and so on...

But above time range has to be in rows even if there are no records in respective time interval.

Is it possible to define a formula or custom function for this?

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 27 Apr 2010 at 4:14am
You basically need to have each time range in data somewhere.  There are a couple of ways to do this.  One is to have every time range in a table and left outer join from that to the time from your data between with the timestamp between the start and end of the range.  Another way is to create a stored procedure that will return a dataset that contains all of the time ranges and, again, left outer join from that to your data with the timestamp between the start and end of your range.  This means that the time range data set needs to be in something like the following format:
 
Start_Date             End_Date
--------------         -------------
22.04.2010 08:00:00     22.04.2010 08:29:59
22.04.2010 08:30:00     22.04.2010 08:59:59
etc...
 
-Dell


Edited by hilfy - 27 Apr 2010 at 4:15am
IP IP Logged
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