Tuesday, September 29, 2015

Changing report design via code SSRS

It is one of the normal development requirements you may came across where you want to change the report design name on the basis of some logic. The following example shows you how to achieve this.

The modification is done in Controller class "outputReport" method, before "super" call you need to set the updated design name based on some condition and its done.

/// <summary>
///    Executes the report for the print management setting that is currently loaded.
/// </summary>
/// <remarks>
///    The <c>outReports</c> method loops over print management settings and calls this method for each
///    print management setting loaded.
/// </remarks>
/// <exception cref="M:Exception::Error">
///    The print management object has not been initialized.
/// </exception>
public void outputReport()
{
    reportDesign = 'MyReport.Report_DesignA';
    this.parmReportName(reportDesign);
    this.parmReportContract().parmReportName(reportDesign);
    formLetterReport.parmReportRun().settingDetail().parmReportFormatName(reportDesign);
    super();
}

No comments:

Post a Comment