Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Check total RunTime Post Reply Post New Topic
Page  of 2 Next >>
Author Message
peter
Groupie
Groupie


Joined: 08 Apr 2007
Location: United States
Online Status: Offline
Posts: 51
Quote peter Replybullet Topic: Check total RunTime
    Posted: 11 Jun 2007 at 2:39pm
Hi,
Is there a simple way to check how long (seconds/minutes) a Report has run ?
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 11 Jun 2007 at 2:49pm
You can create a shared DateTime variable. Save the current time to it when the report starts and then subtract it from the current time when the report is finished.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
peter
Groupie
Groupie


Joined: 08 Apr 2007
Location: United States
Online Status: Offline
Posts: 51
Quote peter Replybullet Posted: 11 Jun 2007 at 3:16pm
Hi Brian:
 
I did like this:
1) StartTime (formula)
BeforeReadingRecords;
CurrentTime
2) EndTime (formula)
CurrentTime
3) TRunTime (formula)
EndTime - StartTime
 
Then on Report Footer, I place the formula TRunTime.
 
IT ALWAYS GIVES 0. Because StartTime and EndTime are equal !!!
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 11 Jun 2007 at 8:26pm
For EndTime, use WhilePrintingRecords and put it in the ReportFooter.  Otherwise it gets calculated in the first pass and will have the same time as the StartTime. I would drop the TRunTIme and just do it all in EndTime:
WhilePrintingRecords;
CurrentTime-StartTime;

Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
peter
Groupie
Groupie


Joined: 08 Apr 2007
Location: United States
Online Status: Offline
Posts: 51
Quote peter Replybullet Posted: 12 Jun 2007 at 12:03pm

Hi Brian:

Thank you for trying to help me out.

The result is still 0.

This should be the simplest thing to do and Crystal Reports can not do it ???. Lot of people must have put up with this piece of J...

Hope you have some other way ???
 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 12 Jun 2007 at 12:05pm
I have some notes at home on this I can check. But I'm pretty sure that this is the only way to do it. It does work for my test reports. So I don't know what wouldn't be working on your reports. How long does this report run anyway? 
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
peter
Groupie
Groupie


Joined: 08 Apr 2007
Location: United States
Online Status: Offline
Posts: 51
Quote peter Replybullet Posted: 12 Jun 2007 at 1:51pm

No matter how long it's run. It always returns 0. I even tried using the Timer function.

Thank you for looking into it.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 12 Jun 2007 at 2:31pm
Do you have the EndTime formula in the report footer with "WhilePrintingRecords" being used? There must be something missing somewhere.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
peter
Groupie
Groupie


Joined: 08 Apr 2007
Location: United States
Online Status: Offline
Posts: 51
Quote peter Replybullet Posted: 12 Jun 2007 at 2:48pm
//This is StartTime formula
BeforeReadingRecords;
Timer
 
//This is EndTime formula
WhilePrintingRecords;
Timer - {@StartTime}
 
And dropped EndTime in Report footer. But results are always 0.
Using CurrentTime or Timer won't make any different.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 12 Jun 2007 at 2:57pm
Ah! I think I see the problem. You are using the StartTime formula name. Thus, it re-calculates it when EndTime is called. Use a shared variable so that it doesn't get revised.

//StartTime formula
Shared DateTime StartTime;
StartTime := CurrentTime;

//EndTime formula
Shared DateTime StartTime;
CurrentTime - StartTime;

Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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.020 seconds.