The data aggregation functionality of ComponentOne DataEngine is faster than any other column-oriented storage approach and processes millions of records in less than a second. You can utilize the potential in integration with other components, especially with ComponentOne FlexReport. When working with C1FlexReport and large datasets, there can be a need to retrieve specific data based on certain groupings. For example, if you are working on some sales data, you might need to create a report to show the number of sales per country, or you might need to create a report to display the data based on the unique combinations of region and country.
In case you need to render about one million records in the report, the C1DataEngine in integration with C1FlexReport will give you the opportunity to process the data and generate the report in fraction of a second.
To understand more on the functionality, the following steps provide guidance on how you can create a report to display the sales data per country using C1DataEngine.
To accomplish this, you need to:
Initially you need to design a flat report based on the requirements. In this sample the flat report, displays sales data by country. First, add TextFields to the detail section for your database values, then design the layout that suits your needs. We have formatted the report in such a way that each record group will be shown in the form of a card, as presented in the following screenshot:
After this, create a Windows Forms Application, add the FlexReport component to load your report, and FlexViewer control into your form to render the report.
To load the report via code, use the following:
To obtain the aggregated data from the referenced dataset the C1DataEngine API will be used as the data source of the FlexReport.
To get the required data, you first need to add the following required packages for using the C1DataEngine API:
This sample will handle one million records via a CSV file containing the sales data. First, initialize the Workspace and IDataCollection objects and create a class containing properties that can hold the data corresponding to the fields in the CSV file.
To get the complete one million records in your Workspace object use the CsvReader as given in the code snippet below:
The specific data that will be extracted from the database is the TotalCost, TotalRevenue, and TotalProfit for each unique country, and this can be done via query using the Op class of the C1.DataEngine assembly.
The results of DataEngine queries are cached, making subsequent executions even more quickly. This query remains cached until the underlying data is refreshed. You can refresh data periodically, for example, hourly or daily, by checking a saved time stamp.
Use the C1DataEngineCollection class to get the data from the workspace based on your specific query and C1DataCollectionBindingList class to be assigned as the data source of your FlexReport based on your C1DataEngineCollection object.
For the report to appear in the FlexViewer at runtime, you must bind the FlexReport to the FlexReport's DocumentSource property.
The report will get rendered in a short amount of time after following all the above processes, and look as in the GIF below:
This demo can be downloaded here.