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:
string EventHandlerName(SessionInfo sessionInfo, DataTable originalDataFields, Entity dataObject, DataObjectBase eventCaller)
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 Syste.Data, WebReports.Api.Reports and WebReports.Api.Data DataTable dt = args as DataTable; DataView dv = dt.DefaultView; dv.Sort = “column_name desc”; return dv.ToTable();