Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

9.13 Timer Function

Timer

The Timer function returns the number of seconds that have elapsed since midnight. This can be used for doing performance evaluations. Unfortunately, it is only significant to the nearest second. So it is only useful for analyzing reports that have lengthy run times. The following code demonstrates timing how long it takes a report to run.

In the report Header put the following formula:

BeforeReadingRecords
Global StartTime as Number
StartTime = Timer
Formula = "" ‘A necessary evil that won't affect the calculation

In the report Footer put the following formula:

WhilePrintingRecords
Global StartTime as Number
Formula = Timer - StartTime
‘This returns the number of seconds it took to run the report

Other Functions

Although this chapter and the last two have listed many useful functions, Basic syntax still has many more to choose from. You’ve seen all the primary ones and I’m going to leave the remaining ones for you to explore on your own.