Debugging Formulas
After you have written a formula, you should check that the formula works correctly. Three types of errors can occur in formulas: syntax errors, runtime errors and semantic errors.
Types of Errors
A syntax error occurs when you violate the syntax of the FPScript language, such as if you have written a keyword incorrectly. FlexPro recognizes this type of error as soon as the formula is compiled into binary code. You can use the command Design[Debug] > Syntax Check at any time to check if the syntax in a formula is correct. If there is a syntax error, this is displayed in the Event Log, and you can select the defective section of code by double-clicking on the message.
A runtime error occurs when there is a problem during calculation of the formula, such as if you were to divide by zero. The calculation of the formula is then canceled and the error is displayed in the Event Log. You can select the defective passage in the code by double-clicking on the message. You can use the command Design[Debug] > Run to calculate a formula on a test basis and thus check whether runtime errors occur. The result of the calculation is displayed in a window.
A semantic error occurs when a formula does not work as the programmer expected. These types of errors are often difficult to find because FlexPro cannot localize them on its own. However, FlexPro offers you the Formula Debugger that you can use to step through the formula and analyze all of the interim results.
Formula Debugger
The Formula Debugger is a powerful tool that you can use to step through and test formulas. Once started, the debugger can be in Single Step mode or in Run mode. You can execute single statements in single step mode and review their results as well as the contents of local variables. In run mode, the formula is processed at normal speed until a breakpoint is reached, it is canceled by you, or the end of the formula is reached.
FlexPro displays the content of selected variables and the result of the statement just executed in the Watch Window while you are debugging a formula.