2011-10-04 57 views
1

我正在使用ReportExecutionService Web服務運行具有報告參數的SSRS報告。我沒有傳遞參數,但讓報告使用它自己定義的默認參數值。因此,執行此操作並獲取正確的報告是沒有問題的。但是,我需要知道參數的值,以便我可以適當地命名結果文件。運行後獲取默認報告參數的值ReportExecutionService.render()

我會希望做這樣的事情(不工作,也沒有ReportExecutionService的成員,我已經能夠找到,這是否)

byte[] returnArray = new byte[0]; 

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

    //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; 

回答

1

因此,原來的一旦您加載報告定義,ReportExecutionService的ExecutionInfo成員就會包含這些參數及其默認值,因此這將起作用:

 //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[]