Created
January 25, 2019 16:13
-
-
Save noakesey/86c902476035b24b67fc351edf1cb7fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected XmlDocument xmlDocument; | |
protected Object contract; | |
protected str reportName; | |
protected SRSReportRunService srsReportRunService = new SrsReportRunService(); | |
protected SRSReportExecutionInfo executionInfo = new SRSReportExecutionInfo(); | |
protected SRSReportRunController controller = new SRSReportRunController(); | |
public void run() | |
{ | |
controller.parmReportName(reportName); | |
controller.parmShowDialog(false); | |
controller.parmLoadFromSysLastValue(false); | |
controller.parmReportContract().parmReportServerConfig(SRSConfiguration::getDefaultServerConfiguration()); | |
controller.parmReportContract().parmReportExecutionInfo(executionInfo); | |
if(contract) | |
{ | |
controller.parmReportContract().parmRdpContract(contract); | |
} | |
SRSPrintDestinationSettings settings = controller.parmReportContract().parmPrintSettings(); | |
settings.printMediumType(SRSPrintMediumType::Custom); | |
settings.fileFormat(SRSReportFileFormat::XML); | |
srsReportRunService.getReportDataContract(controller.parmReportContract().parmReportName()); | |
srsReportRunService.preRunReport(controller.parmReportContract()); | |
Map reportParametersMap = srsReportRunService.createParamMapFromContract(controller.parmReportContract()); | |
Microsoft.Dynamics.AX.Framework.Reporting.Shared.ReportingService.ParameterValue[] parameterValueArray = | |
SrsReportRunUtil::getParameterValueArray(reportParametersMap); | |
SRSProxy srsProxy = SRSProxy::constructWithConfiguration(controller.parmReportContract().parmReportServerConfig()); | |
System.Byte[] reportBytes = srsproxy.renderReportToByteArray(controller.parmreportcontract().parmreportpath(), | |
parameterValueArray, | |
settings.fileFormat(), | |
settings.deviceinfo()); | |
if (reportBytes) | |
{ | |
System.IO.MemoryStream stream = new System.IO.MemoryStream(reportBytes); | |
xmlDocument = XmlDocument::newFromStream(stream); | |
} | |
else | |
{ | |
throw Exception::Error; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment