Scroll

Introduction to Server Events

This section explains how to create Events Handlers that run custom code when reports are executed.

  • To add a new Event Handler select ‘Server Events’ in the Main Menu then click the add button.
  • To edit an existing Event Handler either double click it or select it and click the edit button.
  • To delete an Event Handler select it and click the delete button.

Event Handlers

Event Handlers provide code that Exago can execute when certain events happen during the report execution process. This code can either come from a .Net Assembly method or within Exago configuration.

All existing Event Handlers are listed in the Main Menu under Server Events. All the Event Handlers you are adding or editing will be displayed in a Tab entitled Server Events.

Each Event Handler has the following properties:

  • Name – Provides a unique identifier for each Event Handler
  • Function – Can either be Custom Code or a .Net Assembly method.
    • Custom Code – To save code directly in Exago, select Custom Code from the first function dropdown. Clicking on the second dropdown opens the custom code menu.
      See Custom Code for information on how to access the arguments for each Event. Press the green check mark to verify the code executes properly.

      Custom Code has three properties:
      • Language – Code can be written in C#, Javascript or VB. Net.
      • References – A semicolon-separated list of any .Net Assembly dlls that need to be referenced by the Event Handler
NOTE. System.dll does not need to be listed as a reference as it is already available.
  • Code – The code that will be executed by Exago when called.
  • .Net Assembly Method – To utilize a .Net Assembly method first create a .Net Assembly Data Source. Select the desired assembly from the first Function dropdown. Clicking on the second dropdown will open a list of available methods.
    See .Net Assemblies for information on how to access the arguments for each Event.
NOTE. The Assembly’s dll will be locked by Exago when it is first accessed. To replace the dll, unlock it by restarting the IIS App pool.
NOTE. If you want to utilize the sessionInfo object that is passed to all Event Handlers the Assembly must include a reference to WebReportsApi.dll. For more information see SessionInfo.
NOTE. All methods used as Event Handlers must be static.
  • Global Event – In this dropdown select an Event to indicate that the Event Handler should be called whenever this event occurs for all report execution. Leave Global Event set to ‘None’ to indicate the Event Handler is meant for a specific report.
  • Specified Event – The Event Handler will be called when the specified Event happens during the execution of all reports.

Ex. Selecting OnReportExecuteStart from this dropdown will cause the Event Handler to be called whenever any Report Execution begins.

Custom Code

Event Handler custom code can be saved directly in Exago via the Administration Console. There are two objects that custom code can utilize to access information relevant to an Event.

  • sessionInfo – Without any special references, all custom code can make use of a sessionInfo object that provides access to elements of Exago current session such as parameters, filters, the logger, etc.
  • arguments array – Custom code can also access an array of input values called args[]. For each Event the content of the args array will be different. The content of this array is detailed in Full Description of Events.

.Net Assemblies

Event Handlers can also reside in .Net Assemblies. The following are important details for using .Net Assemblies as Event Handlers.

  • The Assembly’s dll will be locked by Exago when it is first accessed. To replace the dll, unlock it by restarting the IIS App pool.
  • The first argument of all Event Handlers is the sessionInfo object which can be used to access elements within the Exago session. To make use of this object the assembly must reference WebReportsApi.dll.
    If the code does not need to make use of sessionInfo then the method signature in the assembly can declare sessionInfo as an object instead of as a sessionInfo data type. For more information see Available Events.

Hidden Article Information

Article Author
Alex Agoado
created 2015-12-30 17:42:40 UTC
updated 2017-03-13 21:25:31 UTC

Labels
Server Events, event handlers, Custom Code, .NET Assembly,
Have more questions? Submit a request