Print Page | Close Window

Check total RunTime

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=831
Printed Date: 05 May 2025 at 3:37am


Topic: Check total RunTime
Posted By: peter
Subject: Check total RunTime
Date Posted: 11 Jun 2007 at 2:39pm
Hi,
Is there a simple way to check how long (seconds/minutes) a Report has run ?



Replies:
Posted By: BrianBischof
Date 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>


Posted By: peter
Date 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 !!!


Posted By: BrianBischof
Date 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>


Posted By: peter
Date 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 ???
 


Posted By: BrianBischof
Date 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>


Posted By: peter
Date 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.


Posted By: BrianBischof
Date 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>


Posted By: peter
Date Posted: 12 Jun 2007 at 2:48pm
//This is StartTime formula
BeforeReadingRecords;
Timer
 
//This is EndTime formula
WhilePrintingRecords;
Timer - mailto:%7b@StartTime - {@StartTime }
 
And dropped EndTime in Report footer. But results are always 0.
Using CurrentTime or Timer won't make any different.


Posted By: BrianBischof
Date 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>


Posted By: peter
Date Posted: 12 Jun 2007 at 4:37pm

Hi Brian:

I'm really appreciated for your time. That still does NOT work!



Posted By: BrianBischof
Date Posted: 12 Jun 2007 at 8:40pm
After getting quite frustrated that this still isn't working for you, I hit the Business Objects support site to see if they had any tips on the subject. Turns out that they recommend using a subreport in the Report Footer to force CR to calculate the runtime for a report. I guess this is because a subreport always prints last of all the other report objects.

Go to the support site and search on this KB number and let me know if that does the trick for you.c2010570

-------------
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>


Posted By: peter
Date Posted: 13 Jun 2007 at 9:09am

Hi Brian:

Again, thank you for your time. Dont you think this is ridiculous!!!

Just to do a simplest thing. CR/BO has to make a long-long-walk (not sure if it's going to work, but I dont want to spend my time to create a subreport to just get a run-time. I just dont know why CR/BO is still in business.




Print Page | Close Window