Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

5.15 Checking Run-Time Errors with the Call Stack

Checking Run-Time Errors with the Call Stack

Run-time errors occur while a report is being generated. These errors are not caught while you are designing the report because they are syntactically correct. They are usually triggered by data that the report is processing. For example, here is a syntax error that would be caught immediately by the Formula Workshop editor while you are designing the report because you aren’t allowed to divide by zero.

Formula = {Customer.AnnualSales} / 0

Here is a formula that won’t cause a syntax error but could generate a runtime error depending on the data.

Formula = {Customer.AnnualSales}/MonthsOfSales}

This formula is correct as long as the MonthsOfSales field is non-zero. But when the value is zero Crystal Reports triggers an error. When that happens, the Call Stack is displayed within the Formula Workshop dialog box. The Call Stack is displayed in the top left corner and it shows the formula name that triggered the error, as well as the data being used in the formula.



Figure 5-14. The Call Stack.

At the top is the current error and it is followed by the formula causing the error. Under the formula name are the variables and fields that are being used and their current values. By examining this information along with seeing the formula, you should be able to figure out what is causing the problem and devise a method to correct it.