How to programmatically query a list of parameters in a report

To programmatically query the list of parameters in a report, load the report into a C# object model with the Bold Reports® ReportSerializer helper, then read the parameters from the ReportDefinition. The ReportSerializer helper and RDL models in the Bold Reports® library give you information about report elements, as in the following code:

FileStream fileStream = new FileStream( reportFolderPath + "\Resources\sales.rdl", FileMode.Open, FileAccess.Read);

MemoryStream reportStream = new MemoryStream();
fileStream.CopyTo(reportStream);
reportStream.Position = 0;
fileStream.Close();

BoldReports.RDL.DOM.ReportSerializer reportSerializer = new BoldReports.RDL.DOM.ReportSerializer();

// Method to get the reports with ReportDefinition object model
var reportDefintion = reportSerializer.GetReportDefinition(reportStream);

BoldReports.RDL.DOM.ReportSerializer reportSerializer = new BoldReports.RDL.DOM.ReportSerializer();
var dataset = reportSerializer.GetSharedDataSet(readStream);
var reportDefintion = reportSerializer.GetReportDefinition(readStream);

// Property to get the parameters information from report.
var reportParameters = reportDefinition.ReportParameters;

See also