{{sidenavigation.sidenavigationExpandLabel}}
{{getMsg('Help_YouAreHere')}}: {{page.title}} {{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}} {{helpModel.downloadHelpPdfDataStatus}}

Debugging of Formulas

Developing formulas in i-net Clear Reports can be a complex task, especially if a formula refers to database fields or global variables. The most obvious way to check the correctness of a formula is to execute it's report - but this involves a lot of GUI interaction and resources. A much more convenient option is the formula debugger.

Basic concept

The formula debugger is basically a sandbox for a formula. It decouples the formula from the report and thus allows an independent execution. To do so, the debugger sandbox can control all external references of the formula, which are fields and variables. Furthermore the debugger hooks into the formula statement execution so you can step through all processing statements while the formula is executed.

References

References is the generic term for any variable or field a formula refers to. These references are in most cases the input parameters of a formula and directly correlate with the result. The "References" tab of the debugger shows all variables and fields of the current formula as well as their value type and current value.

Setting values

To set a value simply double-click on the value in the references table. The value now has to be entered in Crystal Syntax. It will be parsed and evaluated as a crystal syntax formula to determine the value. If the value is not a correct formula or entered with quotes, it will be set as a String-value.

Examples:

Entered Resolves to Type
ABC ABC String
'ABC' ABC String
1+2 3 Number
[1,2] [1,2] Number, Array
1 to 2 1 to 2 Number, Range
#1.1.2016 1/1/16 Date

Breakpoints

A break point defines a line in a formula where the formula execution has to be interrupted. You can set a break point with the context menu of the formula text editor. As a short-cut you may use the key code Ctrl+Shift+B or double-click on the line number. When the execution halts at such point, you can check and modify the references

Possible pitfalls when using break points

  • Break points are not moved automatically when the formula is modified
  • There is no check whether there is a statement on a break point line
  • To run a report without interruption, remove all break points
  • Break point will have no effect on a server

Debug Exceptions

With this option set, the formula debugger will open up every time a formula causes an error. You cannot use this debugger to recover from the error state but to inspect the references at the time the error occurred. To return from the error debugger, close the window or click 'Run'.

Execution

The debugger can run a formula in different modes: either at once, by line or by statement.

Debug execution controls and modes:

Control Action
Run Starts the execution and will either show the result or stop at the first break point
Stop Stops the execution. In the formula editor this will simply stop the execution. While rendering this will interrupt the formula with an error. (Only active at break points or in stepping/line mode)
Step Executes one operation of the current formula
Line Executes the current formula until the next line
Inspect Evaluates the currently executed term and shows the result. This can be used to find out the result of a certain statement. (Only active at break points or in stepping/line mode)

Live Debugging

The debugger can be used while executing a report as well. Simply set a break point in a formula and a debugger window will pop-up when the break point is hit. Please note that the formula in that window is only for reference, it cannot be modified. The references though can be set here. To prevent the debugger from showing up, please remove all break points.

When the live debugger opens up you can use the full set of controls to continue executing the formula. A modification of the variables is possible as well.

Note: Closing the debugger window will disable the debugging for the rest of the report execution. If you want to debug several formulas via break points, choose to click 'Run' instead.

i-net Clear Reports
This application uses cookies to allow login. By continuing to use this application, you agree to the use of cookies.


Help - Debugging of Formulas