Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
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>
Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
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>
Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
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>
Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
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>
Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
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>
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