Custom Reporting Data SourcesLast Updated: 12/09/2015 Introduced in Verision: 2.0
Custom data sources can also be created via interfaces/subclassing
– specifying resulting cols
– specifying when they apply
– generating data
To write your own custom data source, create a class that inherits from and implements AbstractCustomDataSource and that is decorated with AutoRegisterReportElement.
This implementation will involve overriding at least three methods: bool Applies(ReportDefinition definition), ReportFieldData ReportFields, and DataTable GetData(DataTable table, IReportFilter filters, int? limitCount, int pageIndex). Below is an explanation of each method.
bool Applies(ReportDefinition definition)
The result of this method determines whether or not this data source is shown as an available data source in the report designer. If this method returns false, the data source will not be shown. If it returns true, the data source will be shown. Usually, you will want a data source to show only when no other data source has yet been selected for the report. However, if your data source joins data from another data source, you may want to allow this data source to still be selectable even after another data source has been configured on the report. Below is an example implementation of this method which will hide the data source whenever the report is already configured with any data source.
public override bool Applies(ReportDefinition definition)
return definition.HasDataSourcesOrFilters() == false;
public override ReportFieldData ReportFields
The columns of your data source are defined in this method by returning a array of DecisionsFramework.Design.Report.ReportFieldData
A ReportFieldData is constructed like ReportFieldData("SampleDataSource", "Time", typeof(DateTime)). In this example, "SampleDataSource" is the table name which is defined in the GetData method, "Time" is the name of the column, and typeof(DateTime) is the data type of the data in this column.
public override DataTable GetData(DataTable table, IReportFilter filters, int? limitCount, int pageIndex)
In this method you define the actual data which will be returned to the report by building up a DataTable.