How to Create Report-Level Scripts

This section explains how to create and edit scripts using the Script Editor.

Adding Element-Level Script

To attach a script to a report element, follow the steps below:

1. Right-click the desired report element and select 'Script' from the context menu. This opens the Script Editor.

2. Click the Script or onClick tab, and enter the desired element-level script.

Alternatively, you can follow the steps below:

The Script tab in the 'Format' panel pro­vides quick access for making minor edits.

1. Right-click the desired report element and select 'Format' from the context menu. This opens the 'Format' panel at the bottom of the Report Designer.

2. Select the Script tab in the 'Format' panel. Click the 'Script' or 'onClick' radio button, and enter the desired element-level script.

#1 Ranking: Read how InetSoft was rated #1 for user adoption in G2's user survey-based index Read More

Adding Report-Level Script

To create a report level handler, follow the steps below:

Hint: Check the status bar at the bottom of the Report Designer to make sure no element is selected.

1. Click at the top or bottom of the report to deselect all elements.

2. Right-click in the report area and select 'Script' from the context menu. This opens the Script Editor, which has four tabs corresponding to the four report-level handlers: onLoad, onInit, onPageBreak and onPrint.

3. Click the desired tab, and enter the report-level script.

Locating Scripted Elements

To find all scripts in a report, open the Report Explorer. Elements with script attached are displayed in the Report Explorer with a special “script” icon. To edit an element's script, select a scripted element node in the Explorer, right click and select 'Script'.

Using the Report Script Editor

The Script Editor provides a large text area where you can enter the desired script. The three panels above the text area show the 'Properties', 'Functions', and 'Operators' available for each type of element and object.

Read the top 10 reasons for selecting InetSoft as your BI partner.

Script Editor Options

Click the 'Edit Option' button in the toolbar to configure the Script Editor. This opens the 'Edit Option' dialog box.

Enable 'Show Live Objects' to allow the 'Properties' tree to display properties for current (“live”) elements contained in the report, rather than all available element and property types. Enable 'Show Line Numbers' to display line numbers beside the script.

Syntax Auto-Completion

The Editor's auto-completion feature dynamically suggests valid syntax completions for the object and property names you type. This can help you avoid many errors caused by misspellings.

To use one of the suggestions in the auto-completion list, do one of the following:

• Continue typing until the correct option is highlighted. Then press 'Tab' or 'Enter' on the keyboard to make the completion.

• Press the cursor keys on the keyboard to highlight the desired option. Then press 'Tab' or 'Enter' on the keyboard to make the completion.

• Click the desired option with the mouse to make the completion.

Auto-completion is available in the following cases:

• Completing object names (e.g., “Table1,” “CALC”).

• Completing global function names (e.g., “dateAdd()”).

• Completing object property names (e.g., “Table1.visible”).

• Completing report parameter names (e.g., “parameter.companyName”).

• Completing the right-hand side of an assignment (e.g., “foreground = ...”).

Note that when you type the assignment operator (=), the initial auto-complete list contains an 'Edit Value' option as an aid to specifying fixed values. See Fixed Value Selection for more information. Note that the auto-complete feature cannot provide auto-completions for all possible cases. For example, variables declared within the current script are not auto-completed.

Previous: More JavaScript Syntax Basics