5.2 onInit Handler

A report's onInit script is executed only once, before the report is processed. Because all parameter prompting and automatic query execution occurs after the onInit script executes, onInit script is ideal for one-time initialization tasks. The typical usages are as follows:

Defining report parameters: Because all other scripts execute after parameter prompting, parameter definitions can only be changed from the onInit script.

Defining report parameter default values: You can manually run a query to supply the default values. (See Running a Query for details.)

Note: A variable declared in onInit script will have global scope. To declare a local variable with the same name elsewhere, use the keyword 'var' in the declaration to remove ambiguity.

Creating session-level variables.
For example, you can use the onInit script to perform all one-time calculations, then store the results in global variables so that you can access them from other scripts.

See Also

onLoad Handler, to declare report-level variables, or validate user parameters.

<< 5.1.2 Setting the onClick Range © 1996-2013 InetSoft Technology Corporation (v11.4) 5.3 onLoad Handler >>