Using a Sample JavaScript Script

Each level of the object model has a Methods folder that contains the methods (actions) applicable to objects at that level. You can use the methods to write scripts.

The following procedure provides an example of associating a JavaScript script to a document. The script causes the SalesResults section (object) to activate (method) when the document Sample1.bqy is opened.

  To create a script that activates the SalesResults section when Sample1.bqy is opened:

  1. In Interactive Reporting, open the Sample1.bqy.

  2. Select File, then Document Scripts.

    Script Editor is displayed. OnStartup is selected by default in the Event Trigger drop-down list.

  3. In the object browser, select Application , then ActiveDocument, then SalesResults, and then Methods.

  4. Double-click Activate.

    Interactive Reporting or Interactive Reporting Web Client enters a script in the scripting pane and attaches it to the OnStartup event listed in the Event Trigger drop-down list.

    Tip:

    Expand the view of the object model by dragging the striped arrow at the bottom of the object browser scroll bar.

  5. Click OK to save the script and close Script Editor.

  6. Save and close the document.

  7. Test the script by reopening the document.

    When Sample1.bqy opens, the SalesResults section of the document is displayed by default.