开发者

Get value of default report parameters after running ReportExecutionService.render()

开发者 https://www.devze.com 2023-04-10 08:50 出处:网络
I am using the ReportExecutionService web service to run an SSRS report that has report parameters. I am not passing parameters, but let the report use it\'s own defined default parameter values. So e

I am using the ReportExecutionService web service to run an SSRS report that has report parameters. I am not passing parameters, but let the report use it's own defined default parameter values. So executing this and getting the correct report back is no problem. However, I need to know the value of the parameters so that I can name the resulting file appropriately.

I'd be looking to do something like this (which does not work, there is no member of ReportExecutionService that I have been able to find that does this)

   byte[] returnArray = new byte[0];

   //get the SOAP call to the SSRS service started
   ReportExecutionService rs = new ReportExecutionS开发者_JAVA百科ervice();

   //reportParameters is an empty collection
   rs.SetExecutionParameters(reportParameters, "en-us");             

   //The report renders successfully, using the default vales in the RDL
   returnArray = rs.Render(format, devInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);

   //this is what I want to do, where the nonexistent executionParameters member
   //contains the report parameters with default values defined in the report
   String fileName = "reportName" + rs.executionParameters["startDate"].Value + "-" + rs.executionParameters["endDate"].Value + "." + extension;


So it turns out that the ExecutionInfo member of the ReportExecutionService contains the parameters and their default values once you have loaded the report definition, so this will work:

        //get the SOAP call to the SSRS service started
        ReportExecutionService rs = new ReportExecutionService();

        //this will contain all of the details needed for execution
        ExecutionInfo execInfo = rs.LoadReport(reportLocation, historyID);

        //and here are the default value(s)
        execInfo.Parameters[i].DefaultValues[]
0

精彩评论

暂无评论...
验证码 换一张
取 消