This post describes how to run an SSRS report through x++ code and passing report parameters as well. Its a simple code and comments are added for further ease in code understanding!
// set report parameters
controller = new SrsReportRunController();
controller.parmLoadFromSysLastValue(false);
controller.parmLoadFromSysLastValue(false);
// write report name and its design in quotes that you want to run
controller.parmReportName("ReportName.DesignName");
controller.parmReportName("ReportName.DesignName");
// set additional, optional properties like setting landscape to true
controller.parmReportContract().parmPrintSettings().landscape(true);
controller.parmReportContract().parmPrintSettings().landscape(true);
// set print destination screen/printer/file etc.
controller.parmReportContract().parmPrintSettings().printMediumType (SRSPrintMediumType::Screen);
controller.parmReportContract().parmPrintSettings().printMediumType (SRSPrintMediumType::Screen);
// set report parameters
controller.parmReportContract().parmRdlContract().setValue("AX_CompanyName","DAT");
controller.runReport();
}
controller.runReport();
}
public static void runSSRSReport()
{
SrsReportRunController controller;