you're reading...

Reporting from objects

For the past month or so the Data Dynamics Reports team has been hard at work attacking various performance issues in the product.  My goal is to have one of the fastest reporting engines in our class, and we’ve made some great strides in that regard already.  We measure the performance by running various standard reports with different size data sets and measure various attributes while we do so.

We have an internal utility that we use which automates this process and spits out a CSV file, each line being a set of 3 runs of a report.  We also run the same report through a competing product to give us a baseline, so for each report there are 2 rows of data.


While this format is easy to generate, it is harder to consume and make comparisons; for example it isn’t possible to compute the difference between the two products on this one report without first manipulating the data.  This is easily done through code; and by using the Object data provider in DDR it is easy to put this manipulated data into a report.

Here is the code I use to render a report to PDF.

private static void ExportToPdf(ReportDefinition reportDefinition, object data, FileInfo outputFile)
	var runtime = new ReportRuntime(reportDefinition);
	runtime.LocateDataSource += (sender, args) => args.Data = data;

	var pdf = new PdfRenderingExtension();
	var streamProvider = new FileStreamProvider(outputFile.Directory, outputFile.Name);
	var settings = new NameValueCollection();

	runtime.Render(pdf, streamProvider, settings);

Here data is what I’m binding the report’s dataset to. In this particular case I’m passing in a List<PerformanceRecord> or List<ComparisonRecord>. To keep this code generic I didn’t restrict the parameter to IEnumerable because this same code could be used to bind to an ADO.NET DataTable or DataSet as well.

Overall this was an easy project to implement, the only part that was difficult was writing the code to manipulate the CSV data into a usable format.


About James

I am a Senior Developer/Consultant for InfoPlanIT, LLC. I previously spent over 7 years as a Product Manager for what eventually became ComponentOne, a division of GrapeCity. While there, I helped to create ActiveReports 7, GrapeCity ActiveAnalysis, and Data Dynamics Reports.


No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: