Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Counting Busy Transaction Periods Post Reply Post New Topic
Author Message
rftd
Newbie
Newbie


Joined: 09 Jun 2008
Online Status: Offline
Posts: 24
Quote rftd Replybullet Topic: Counting Busy Transaction Periods
     Posted: 12 Jun 2009 at 12:36pm
Hi,
 
I have a 'transaction summary' database which is basically a log of every transaction that occurs over our network. Each entry in the database has information such as: Time, Source IP, Destination IP, Transaction Type, and some other things.
 
I'm trying to create a report that calculates the 'busiest one hour period'. Basically, I want crystal reports to do a count of the number of transactions for each 1 hour period (e.g. 1:00-1:59, 2:00-2:59, etc.) and tell be which of these periods had the most transactions. For example, lets say I had the following databse entries:
 
Time          Source IP             Transaction Type
01:00        127.0.0.1                        A
01:11        127.0.0.1                        A
01:35        127.0.0.1                        A
02:16        127.0.0.1                        A
03:05        127.0.0.1                        A
03:45        127.0.0.1                        A
 
 
Then, I would want my report to say something like:
 
Busiest One-hour Period: 1:00-1:59
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jun 2009 at 12:40pm

Extract the left two characters from your time field and group on that.

Do a record count under that group.
Do a top N as 1 record selection.
IP IP Logged
rftd
Newbie
Newbie


Joined: 09 Jun 2008
Online Status: Offline
Posts: 24
Quote rftd Replybullet Posted: 12 Jun 2009 at 1:34pm
Thanks!
 
I have a followup to that quesiton.
 
Lets say instead of just the time field, there was a DateTime field. Now, in addition to being able to display the 'busiest hour' I also want to display the 'busiest day'.
 
Keep in mind that the busiest hour is not necessarily during the busiest day. As such, I'm not sure if the grouping idea above would still work.
 
thanks in advance
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jun 2009 at 1:43pm

You would want to group it by the day and do the same process.

If you are using a datetime field just select it and group it and use the dialogue box to select "for each day".
You can also do this "for each hour" but it will be each hour for each day if your data spans more than one day.


Edited by DBlank - 12 Jun 2009 at 1:45pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jun 2009 at 1:51pm

If you want it for each hour regardless of the day and it is a datetime field you can extract the hour from it and group on that.

hour({table.datetimefield}
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