Monday, January 25, 2010

Active Reports - Parameter Passing

Well, it has been awhile since I've posted. I've just been cruising along with the coding, just a matter of getting it done rather than running into walls. I thought I would post a simple little post on passing parameters or data to a report.

I'm sure there is some sort of an official way of passing data to Active Reports, but I usually take a simple route when it comes to coding. Last week, I needed to pass data to a report, so I googled it. And sure enough, it was easy. I was in the mode of "this is reporting, it is limited!". Of course, Active Reports are also Classes so that was the answer to my problem!

I created private attributes that have Properties defined - getter and setter, although I only needed the setter.

so pretty much it is just like any class. here's the code snippet:

public partial class SummaryReport : DataDynamics.ActiveReports.ActiveReport
{

private bool _showPicture = true;

public bool ShowPicture
{
get { return _showPicture; }
set { _showPicture = value; }
}
.....

so to pass data outside this report, I would call:

SummaryReport rpt = new SummaryReport();
rpt.ShowPicture = false;


That's it. Pretty easy, but possibly overlooked.

}