Domanda

I am extending an existing app to host SSRS reports with an ASP.Net WebForms ReportViewer control. There are a large number of existing reports. That would not be a problem except that we also need to pass another parameter to each report.

Someone on our team suggested that we might be able to add another parameter and SSRS would pass it along to the stored procedure associated with each report. Not knowing anything about reporting services I looked into it.

I tried the following:

private void AddNewParameter(Report report)
{
    var reportParameters = new List<ReportParameter> { new ReportParameter(paramName, "foo", false) };
    report.SetParameters(reportParameters);
}

The call Report.SetParameters() complains about the new parameter not existing on the report. The MSDN page for SetParameters() has a note near the bottom that says:

"The parameters specified for the SetParameters method must be defined in the original report definition."

Can anyone confirm the sinking feeling I have that all of our reports must be changed to take the new parameter?

È stato utile?

Soluzione

The approach you are attempting is going to be a dead end. Sorry. Sinking feeling is confirmed. However...

If there are a ton of reports then you could probably work out an automated approach to update them all by modifying the underlying Report Definition Language. The link I just posted will take you to the TechNet article that has further links to the actual schema definitions for each version etc.

RDL is really just XML, to quote the TechNet article directly:

RDL is composed of XML elements that match an XML grammar created for Reporting Services. You can add your own custom functions for controlling report item values, styles, and formatting by accessing code assemblies within report definition files.

Only you could weigh the work of developing this type of solution vs the manual approach.

To get an idea of changes required:

  1. Save copy of one report.
  2. Modify the report with changes
  3. Compare modified rdl to original (BeyondCompare, notepad++, whatever)

If your comfortable with parsing XML, then reproducing the change across remaining reports would be entirely do-able.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top