Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: maximum amount Post Reply Post New Topic
Author Message
cisco711
Newbie
Newbie


Joined: 01 Nov 2010
Location: United States
Online Status: Offline
Posts: 10
Quote cisco711 Replybullet Topic: maximum amount
     Posted: 01 Nov 2012 at 9:46am
I am subtotal the amount of vehicles by then hour of the day. I want to know the highest number of vehicles on the street per hour over a period of a month.
 
Any suggestions?
 
Thx
IP IP Logged
cisco711
Newbie
Newbie


Joined: 01 Nov 2010
Location: United States
Online Status: Offline
Posts: 10
Quote cisco711 Replybullet Posted: 01 Nov 2012 at 9:58am
by the hour of the day, excuse my spelling :)
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 02 Nov 2012 at 8:58am
using just CR bound straight to the tables, nothing really comes to mind...because I am assuming that when a vehicle is out on the road, the data is basically a start and stop time, not based on a time of the day.
 
so you would need to create data that converts the start/stop times to multiple records for each hour (or part there of, I am again assuming), and creating data in cr is fairly hard. 
 
with that in mind, the ideas that come to mind are:
1) create a command object that has the dates desired broken down into hours so that you can link on them (not sure if this is possible)
2) my standard solution, create a stored procedure. In the stored procedure, you can easily pass in the start date/time and end date/time (if time is even a desired parameter). You can then create a table of date times and populate a table with the vehicles that out on the road with start/stop time bracketing the specific time.  This would allow you to 'create' multiple records per vehicle and accomplish the report's aim.
 
I do realize that a stored proc is at times not feasible, either because of lack of knowledge or privileges on the database or both.
 
Hopefully, one of these will lead to a solution.
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 04 Nov 2012 at 7:28pm
Hi
 
First you need to filter the records for a month.  As you said your report is a group on hour and also u have sub totals.
 
Now go in Group Sort Expert-- Select Top N (1) based on your sub totals.
 
It will give you the maximum sub total which is your highest number of vehicles on that particular hour.
 
 
Thanks,
Sastry
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