/
Scripts in Parameter Definition

Scripts in Parameter Definition

Intellicus provides scripting support for parameter value validation for all parameter types (combo, textbox, radio, checkbox, etc.)  Script will return true (parameter value is valid) or false (parameter value is invalid).  If validation fails, it can also set an error message. You can add script under the Advanced tab of Parameter Object Editor or select Scripting under Tools menu in Studio application.

Scripting is available at:

  • Form level (can be defined on Parameter Form layout dialog on Studio)

  • Parameter level (defined on Parameter detail dialog box)

Input Parameter Form Level

When a report has user parameters, Input Parameter Form is presented to the user to enter run time parameter values.  Use Form level scripting to validate parameter values entered on IPF.

You can open Script Editor dialog from Parameter Form Layout dialog to write the script.

At IPF level (Form level), OnSubmit() event is supported.  It means script is executed when user clicks OK / Run button on IPF. A user can write any valid java script code within this function. This function MUST return a boolean value.

If all the parameter values are valid, it should return true, if one or more parameter values are invalid, it should return false. If script returns false then an error message will be displayed to the user and he/she would not be allowed to submit the IPF and execute the report.  You can also set the error message that should be displayed to the user.

Script can access any parameter of the report.  This includes parameter objects (even if not imported) and global business parameters.  This will be Read-only access (parameter objects and global business parameters).

Note: In case of JavaScript error, Report Server will respond with ERROR.

Parameter Level

You can add a validation script for a parameter being designed on Parameter Detail dialog.  You can open Script Editor dialog from here to write the parameter validation script.

At parameter level, OnChange() event is supported.  It means, validation script will be executed when:

User types in a value for the parameter (for input type TEXT), or

Selects/Unselects value from the parameter combo/list/tree.

Checks/ Un-checks a check box.

Validation script written at parameter level can access other report parameters.  It can also access parameter objects (even if not imported) and global business parameters.  This will be Read-only access.

If the parameter value is valid, script should return true.  If it is invalid, script should return false.  You can also set an error message that should be displayed when parameter validation fails.  Report will not be generated if parameter validation fails.

Using Parameter Level script, you can also modify attributes of parameters and control/change the way IPF is shown.  For example, if paramA is invalid, disable paramB.  IPF will reload parameters that are affected by the script.

Using script, you can also change parameter UI control attribute:

ENABLE: READ / MODIFY at Parameter level and READ ONLY at Input Parameter Form level.

Note: If such a report is scheduled, then IPF is presented at the time of setting the schedule and so, script will be executed only at the time of scheduling (and not at every time when schedule executes).

In case of scheduled report execution, IPF is not displayed. Hence, script will be executed at the time of saving of schedule tasks.  Script will not be executed at report run time.

Related content

Copyright Kyvos, Inc. All rights reserved.