Events
Events are scripts (or procedures) that will trigger a specific action at a specific time. Events can either be connected to public methods in a linked template script or to a procedure. For more information about how to use a procedure (SQLPROC & SQLDDL) in an event, see "use procedure in events".
- If a template script is going to be linked to an event, then you first need to create the script in Script Editor. The script is written in C# language and can contain several different functions. If a procedure is going to be linked to the template event, skip this step.
- Link the template script you just created in Script Editor to the template you want to create the event.
- Access Template Design for the specific template and select the Events right panel tab.
- In the Events tab, you can view any existing event already linked in the template and you can add, edit, or delete Events. In the right panel, within each Event grid, you can also re-order the Events so that they will be triggered in the correct order.
The following events can be used in v1 templates:
Available Events |
Valid in template types |
Description |
---|---|---|
Before Document Creation |
REPORT/FORM/GRIDFORM |
Trigger an event before the document is generated. |
Before Formvalues Saved |
FORM/GRIDFORM |
Trigger an event when clicking the Update Values button in the ribbon. This event will be triggered before any check or save of values are performed. |
After Document Creation |
REPORT/FORM |
Trigger an event after the document is generated. |
After Formvalues Saved |
FORM/GRIDFORM |
Trigger an event after the values in the form are saved to the database. |
After Workbook Completed |
REPORT/FORM |
Trigger an event to alter the workbook after subtotals have been generated (with a template script). This event is the absolute last step before the workbook is shown to the user. |
The following Events are not supported in v1 templates and therefore not visible in Events right panel in HTML5 client:
-
Before_Delete_Values
-
After_Dynamic_Columns_Creations
-
After_Formvalues_Checked
In the Add New/Edit Event dialog, the following must be specified:
-
Event (mandatory): At what time do you want the Event to actually trigger?
- The order of Events display in the same order as execution.
- Function Type (mandatory)
Below is a list of the available Function Types:
Function Type |
Valid in template types |
Description |
---|---|---|
Script Function |
REPORT/FORM |
Trigger a customized event written in a template script. If the template is linked to a template script, all public methods within that script will be visible in the Function drop-down if "Script function" is selected as the Function Type. |
SQL Procedure |
REPORT/FORM/GRIDFORM |
Trigger an event procedure. If Function Type "SQL Procedure" is selected, then available procedures will be visible in the Function drop-down. This is the only Function Type applicable for events in gridforms, so the Function Type option is not visible in gridform editor. |
SQL DDL |
REPORT/FORM |
Trigger an event procedure to fill a temp table with data. If a SQL DDL is first initiated, then a SQL procedure event could thereafter be added to read the temp table.
Using SQLDDL to create temp table is only useful in event Before Document Creation. |
In addition to above Function Type, TEMPLATE can also be used in Events. For more information, see https://insightsoftware.atlassian.net/wiki/spaces/IP/pages/2559803624/Execution+of+templates+after+save.
- Function (mandatory): Depending on the Function Type selected, this drop-down will show public methods from linked template script or procedures. Select the function that should be triggered when the event is executed.
- Parameters (mandatory if procedure or script requires it): If the selected script method or procedure requires any input variables, the parameters will be visible in the grid. Fill out the values for each parameter that should be sent into the script method or procedure when the event is executed.
- Visible text (optional): To enter a more descriptive text that should be visible to the user when the document is generated, see "Descriptive text in events".
When finished, Save the template with the new or edited event and preview or publish.
In the EVENTS worksheet in the workbook, the properties for all events in the workbook are saved. In the Events right panel, you can view them in an overview and manage them by editing, deleting, re-ordering, or adding a new Event.