Checking JavaScript expression syntax
BIRT Report Designer’s expression builder and script editor support writing JavaScript. Both editors validate the code by checking for syntax errors. The checking validates only JavaScript grammar not the semantics of the scripts.
The expression builder supports checking the code for syntax errors, as shown in Figure 41‑2, in the following two ways:
*Selecting the Validate button
Information about the syntax error appears below the expression builder title bar.
*Choosing OK
A warning message appears if the script editor detects a syntax error. Choosing OK on the message saves the code. Choosing Cancel closes the message and returns focus to the expression builder.
Figure 41‑2 Checking for JavaScript syntax errors in the expression builder
The script editor validates code dynamically. As the developer types JavaScript code, the editor validates the syntax and uses a red cross mark on the left border to indicate any line containing an error.
The line containing the error is marked, as shown in Figure 41‑3.
Figure 41‑3 Checking for JavaScript syntax errors in the script editor
A description of the error appears in a text box when the developer moves the mouse pointer over the error indicator on the left border, as shown in Figure 41‑4.
Figure 41‑4 Displaying a syntax error message in the script editor