Operation Manual

Using Formulas
Debugging formulas
22
432 Crystal Reports User’s Guide
Debugging evaluation time errors
When the Formula Workshop is being displayed as a result of an evaluation
time error, the Workshop Tree will contain a call stack. The root of the tree
provides a description of the error which occurred. The nodes in the tree
provide the names of the custom functions and/or formulas which were being
evaluated when the error occurred. The custom function/formula at the top of
the call stack is where the error was detected. The custom function/formula
next in the stack has invoked the custom function/formula above it in the
stack. If you select a custom function/formula node in the tree, the text of the
custom function/formula will be displayed in the editor window and the text of
the expression being evaluated when the error occurred will be highlighted. If
you expand a custom function/formula node in the tree, the variables being
used in the custom function/formula will be shown along with the value they
had at the time the error occurred.
Example of an evaluation time error
Using the sample report “Custom Functions.rpt”, create a new formula that
divides 1 by the result of the @Calendar Days Between function. The function
would look like this in Basic syntax:
formula = 1/{@Calendar Days Between}
It would look like this in Crystal syntax:
1/{@Calendar Days Between}
Insert this formula into the details section of the report and preview it. You’ll
get a division by zero error and the formula editor will be invoked with the call
stack on the left hand side.
Debugging tutorial
Follow the example below to learn the necessary steps for debugging a
formula. After completing this exercise, use the same principles to debug your
own formulas.
About this tutorial
This tutorial uses the Xtreme.mdb sample database.
This tutorial uses Crystal syntax.