Report Design
 Crystal Reports Forum : Crystal Reports .NET 2003 : Report Design
Message Icon Topic: Need Help Post Reply Post New Topic
Page  of 2 Next >>
Author Message
Tejaswini
Newbie
Newbie
Avatar

Joined: 21 Aug 2008
Location: India
Online Status: Offline
Posts: 6
Quote Tejaswini Replybullet Topic: Need Help
    Posted: 21 Aug 2008 at 5:44am

I am using a database view for designing crystal reports.
That view has data collected for every 5 mins.

In my report I want to find the sum of a particular field say "x" for every hour in the selected duration(start date till end date).

The summary function in crystal reports will provide the results for selected option say "Sum" but it will give the sum of "x" which we get every 5 mins (collection interval).

In our report we want to add the values for every hour and not 5 mins i.e. if we consider the start date as "7/14/2008 12:00:00 AM" then we want to add the value of parameter "x" at "7/14/2000 1:00:00 AM", "7/14/2000 2:00:00 AM", "7/14/2000 3:00:00 AM", and so on till the end date.

But the database has values for every 5 mins interval i.e. "7/14/2000 1:00:00 AM", "7/14/2000 1:05:00 AM", "7/14/2000 1:10:00 AM", and so on.

We want to skip the values in between and add only the hourly value.

How this can be achieved.

 
Any help or guidance is appreciated.
Tejaswini
IP IP Logged
rajacm
Newbie
Newbie
Avatar

Joined: 21 Aug 2008
Online Status: Offline
Posts: 10
Quote rajacm Replybullet Posted: 21 Aug 2008 at 11:02pm

hi,

In RecordSelectionFormula use the DateAdd function to set the interval of one hour. This should solve ur problem.
 
-Raja
 
IP IP Logged
Tejaswini
Newbie
Newbie
Avatar

Joined: 21 Aug 2008
Location: India
Online Status: Offline
Posts: 6
Quote Tejaswini Replybullet Posted: 22 Aug 2008 at 6:38am
Hello Raja,
 
Thanks for your reply.
Tried this option but it didn't work Cry
 
 
Regards,
Tejaswini
Tejaswini
IP IP Logged
rajacm
Newbie
Newbie
Avatar

Joined: 21 Aug 2008
Online Status: Offline
Posts: 10
Quote rajacm Replybullet Posted: 25 Aug 2008 at 12:58am
Another way is, in RecordSelectionFormula add a condition
like
<time part of filed> in ('00:00:00 AM', '1:00:00 AM', '2:00:00 AM' ...   '11:00:00 PM' )
this is little bit tedious. try once.
 
-raja
 
IP IP Logged
Tejaswini
Newbie
Newbie
Avatar

Joined: 21 Aug 2008
Location: India
Online Status: Offline
Posts: 6
Quote Tejaswini Replybullet Posted: 26 Aug 2008 at 5:25am
Hi Raja,
 
Not working :(

I am trying running total fields option

In this I have given conditions as follows:

Field to summarize: <parameter 'x' whose addition needs to be done>

Type of summary: sum

Evaluate
On change of group: <done grouping on timestamp for each hour>

Reset
On change of group: <done grouping on host for which need to add values of parameter 'x'>

I guess this should give me the expected results but somewhere it is still failing.

Need advice on this.

 
Thanks.
Tejaswini
IP IP Logged
rajacm
Newbie
Newbie
Avatar

Joined: 21 Aug 2008
Online Status: Offline
Posts: 10
Quote rajacm Replybullet Posted: 27 Aug 2008 at 3:24am

Hi Tejaswini,

U tried well but, i am sorry it may not work out it seems.
U are left with the option to use recordselectionFormula as given below.
 
Minute ({CATS.DATE_ENTERED}) = 00
 
then use the Summary field to summary of another field which u requied.
remember that if u use this u need to remove the grouping in CR.
 
it worked for me...hope it hleps u.
-Raja.
 
 
IP IP Logged
Tejaswini
Newbie
Newbie
Avatar

Joined: 21 Aug 2008
Location: India
Online Status: Offline
Posts: 6
Quote Tejaswini Replybullet Posted: 27 Aug 2008 at 4:05am
Hello Raja,
 
The problem here is my database has values for every 5 mins but it is not always a round figure i.e. 1:00:00 AM or so. Database has values depending on when the user has added that added i.e. it can be 1:01:00 AM or 1:03:00 AM.
It is not the case that the minutes field will be "0" always. It can vary.
Due to this constraint i cannot use the record selection formula that u have mentioned.
 
My DB has timestamp values as mentioned below:
 
8/21/2008  12:53:25 PM
8/21/2008  12:58:25 PM
8/21/2008  01:04:25 PM
.
.
.
so on
 
Somehow I need to get the hourly value and sum it up Confused
 
Thanks,
Tejaswini.
Tejaswini
IP IP Logged
rajacm
Newbie
Newbie
Avatar

Joined: 21 Aug 2008
Online Status: Offline
Posts: 10
Quote rajacm Replybullet Posted: 27 Aug 2008 at 4:23am
hi Tejaswini,
 
In that case also we may not get the exact hourly totals....
can u take hour's first record. for totaling...
 
-raja
IP IP Logged
Tejaswini
Newbie
Newbie
Avatar

Joined: 21 Aug 2008
Location: India
Online Status: Offline
Posts: 6
Quote Tejaswini Replybullet Posted: 27 Aug 2008 at 5:45am
In this case I need to take the hour's last value i.e. 12:58:25 AM then 1:58:25 AM, 2:58:25 AM.... so on till the last date/time and then sum them up.
 
To achieve the above mentioned summation logic I tried using "Running totals Field" option but I am not getting the expected values. For this I have done grouping on timestamp for each hour (which picks up the last value of the hour). somehwre my running totals is failing :(
 
As u said "can we take the hour's first record for totalling", by taking the first value of hour how can we get the expected result?
 
Thanks.
Tejaswini
IP IP Logged
rajacm
Newbie
Newbie
Avatar

Joined: 21 Aug 2008
Online Status: Offline
Posts: 10
Quote rajacm Replybullet Posted: 28 Aug 2008 at 5:49am
hi Tejaswini,
In that i think we need to create a function in database which can get the last record of the first hour of the start date and compares the current record <datetime field > with the only time part .  and if it matches it returns true else false
Use this funtion to create new column in ur view.
then based on the bool column u can sum the records..
 
!!One more option!!
 
-Raja
 
IP IP Logged
Page  of 2 Next >>
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.029 seconds.