Scripting Support for Parameter Value Validation
Applies to: Kyvos Reporting
Kyvos Reporting provides scripting support to validate parameter values across various parameter types, including combo box, textbox, radio button, and checkbox. You can use scripts to enforce validation logic that returns true (valid) or false (invalid), and optionally display custom error messages when validation fails.
Scripts can be configured under the Advanced tab of the Parameter Object Editor or through the Scripting option available under the Tools menu in Kyvos Reporting Studio.
Scripting is supported at the following levels:
Input Parameter Form (Form-level)
Individual Parameter (Parameter-level)
Input Parameter Form (Form-Level Scripting)
When a report contains user-defined parameters, the Input Parameter Form (IPF) is displayed at runtime. You can add scripts at the form level to validate all parameter inputs before the report is executed.
To define a form-level script:
Open the Parameter Form Layout dialog.
Launch the Script Editor.
Write validation logic inside the
OnSubmit()function.
Behavior:
The
OnSubmit()function is triggered when the user clicks OK or Run.The function must return a Boolean:
true: All values are valid.false: At least one value is invalid. The report will not run, and an error message will be displayed.
You can set custom error messages within the script.
Scripts can access all report parameters, including:
Parameter objects (imported or not)
Global business parameters
(Read-only access)
Note
If the script contains JavaScript errors, the Report Server returns an ERROR.
Parameter-Level Scripting
You can also define scripts at the individual parameter level using the Parameter Detail dialog.
To define a parameter-level script:
Open the Script Editor from the Parameter Detail dialog.
Write validation logic inside the
OnChange()function.
Behavior:
The
OnChange()function is triggered when:A user enters a value (for textbox-type parameters).
A value is selected or deselected (combo box, list, tree).
A checkbox is checked or unchecked.
The script must return a Boolean:
true: The value is valid.false: The value is invalid. A custom error message can be displayed, and the report will not run.
Parameter-level scripts can:
Access other report parameters, parameter objects, and global business parameters (read-only).
Modify attributes of other parameters to control the IPF dynamically.
For example, disable Parameter B if Parameter A is invalid.
You can also modify the UI control attributes of parameters using scripts:
ENABLE attribute:
Read/Write access at the parameter level.
Read-only access at the IPF level.
Scripting and Scheduled Reports
When a report is scheduled, the Input Parameter Form appears only once—during schedule configuration.
Scripts execute only when the schedule is being saved.
Scripts do not run at each scheduled execution time, as the IPF is not shown during automated runs.