Configuring Studio Reports Events
Applies to: Kyvos Reporting
Section Events
In Kyvos Reporting Studio, each section of a report supports three lifecycle events. These events are triggered in sequence during report processing and rendering, based on summary objects and their associated section dependencies.
Event Sequence
Format
This event is triggered after data is loaded and bound to fields, but before the section is rendered. Use this event to:
Modify the layout or appearance of the section.
Set or update control properties based on bound data.
Note
This is the only event where you can modify the section's height.
BeforePrint
This event is triggered immediately before the section is rendered on the canvas. Use this event to:
Modify control values before printing.
Important
Avoid accessing report fields directly in this event. If needed, store values in hidden controls during the Format event and reference those here.
AfterPrint
This event is triggered after the section has been rendered. Use this event to:
Update counters or perform post-render operations.
Track runtime values or status flags for later use.
Script Editor for Event Configuration
You can write scripts for section-level and field-level events using the Script Editor in Kyvos Reporting Studio.
Accessing Script Editor
Click the Script Editor icon on the toolbar, or
From the Tools menu, select Scripting.
The Script Editor – JScript window appears.
Compiling Scripts
After writing your script, click the Compile button to validate it.
If the syntax is valid, a confirmation message appears.
If there are errors, they are displayed in the error pane below the script editor. Correct the errors and recompile.
Find and Replace
To access Find and Replace:
Click the Find icon or press Ctrl+F in the Script Editor.
You can:
Search up or down within the script.
Enable the Match Case or Match whole word only options.
Select Find and Replace to enable replacement actions.
Use Replace to replace the current match.
Use Replace All to replace all instances.
Using Script Objects and Events
Kyvos Reporting scripting allows access to report objects and controls through a defined object hierarchy.
Report Object Hierarchy
Report objects and their events are exposed in a hierarchical structure, where specific events are tied to specific objects.
Example: rpt.sections("Detail").controls("lblAmount").visible = false
Context-Sensitive Help
The Script Editor offers auto-complete and context-sensitive help as you type. Typing object prefixes like rpt. displays a list of relevant members and methods.
Accessing Fields and Layout Controls
Fields
Use the rpt.Fields collection to access or define fields dynamically.
Add a new field in Initialize event:
rpt.fields.add("<MyField>");
Warning
Ensure the field name is unique to avoid runtime errors.
Set a field value in OnFetchData event:
rpt.fields("SomeFieldName").value = "<SomeValue>";
Layout Objects
To access and control layout elements (such as labels, images, or textboxes), use:
rpt.sections("SectionName").controls("ControlName").property = value;
Example:
rpt.sections("Detail").controls("imgLogo").visible = false;
Important
Scripts cannot access the database directly. Use them only for runtime control, formatting, and data manipulation logic within the layout.