Wednesday, October 12, 2005

ActiveReports by Data Dynamics

One of my current projects is a stand-alone Windows Forms app, and it has some reporting needs. In the past, I would have used Crystal Reports for something like this, but at the moment, I can't stand Crystal, so I looked for alternatives.

SQL Server Reporting Services had to be ruled out because this app must be self-contained, and didn't use SQL Server as the back-end data source.

That really only left ActiveReports. They've been a great supporter of DotNet Rocks! since the beginning, so that had some influence on my decision. Another thing is that Data Dynamics is an Ohio-based company, and at one time, they occupied a suite next to my company's headquarters (in a previous form of existence of my company, that is).

The first thing that wow'd me was the fact that reports themselves are objects. Sure, there's a report designer and RPX files and all of that. But, at runtime, you have full access to the object model of the report. That's powerful (yeah, yeah, Crystal had somewhat of the same thing, but I can't get the bad taste out of my mouth quite yet).

So, I was able to create a delegate and use it from within the report's code-behind in order to do some event-driven changing of column header text to match my data. The way it works is this: My app creates an instance of the report, which has a subreport in the detail section. The report code creates the instance of each subreport and sets the data source accordingly. The delegate is then used to invoke a method of my application code (i.e., a callback) passing the reference to the newly created subreport. My app then sets the column header text to the unique values, and voila! I get a customized report at runtime.

Sorry that I can't really get more specific with examples. Much of this is under NDA, so I can really only talk about the technologies used in implementing the app.