Global Event: OnDataFieldsRetrieved

The OnDataFieldsRetrieved Event occurs after Data Fields are retrieved for a specific Data Object. This event is commonly used to change the order Data Fields are displayed in the Data Menu of the Report Designer.


For custom code the args array is structured as follows:

args[] is contains three objects, the first a System.Data.DataTable containing the names and metadata of the Data Fields, the second the Data Object as a WebReports.Api.Reports.Entity object, the third a reference to a WebReports.Api.Data.DataObjectBase object which calls the event.

For .Net Assemblies the method signature is as follows:

DataTable EventHandlerName(SessionInfo sessionInfo, DataTable originalDataFields, Entity dataObject, DataObjectBase eventCaller)

Expected Return

Expects a System.Data.DataTable return value, which represents the modified data.


The DataTable being being passed to the event in the first argument has already applied Column Metadata.


The following example shows how the fields could be displayed in reverse alphabetic order.

//this code example makes reference to System.Data.dll and System.xml.dll and uses the namespaces System.Data, WebReports.Api.Reports and WebReports.Api.Data

DataTable dt = args[0] as DataTable;
DataView dv = dt.DefaultView;
dv.Sort = “column_name desc”;
return dv.ToTable();

Hidden Article Information

Article Author
Exago Development
created 2017-02-21 16:06:31 UTC
updated 2019-06-20 15:18:29 UTC

Server Events, data, event handlers, list of server events, data field, fields, retrieved, datafieldsretrieved, fieldsretrieved, data object,
Have more questions? Submit a request