0

I have some VB.net code that retrieves all the report parameters for an SSRS report. According to the MSDN documentation the Visible and PromptUser properties should correlate to whether the report displays a prompt for that parameter (rather then just an error if not supplied). However in this sample code these properties always come back true. The code references the MS.ReportViewer.WebForms dll. I've tried version 10 and 11.

Public Function GetReportParameters(strPath As String) As List(Of Microsoft.Reporting.WebForms.ReportParameterInfo)
    Dim lstParams As New List(Of Microsoft.Reporting.WebForms.ReportParameterInfo)
    Dim objRV As New Microsoft.Reporting.WebForms.ReportViewer
    objRV.ServerReport.ReportServerUrl = New System.Uri("http://localhost/ReportServer/")
    objRV.ServerReport.ReportPath = strPath
    Dim oRptParams As Microsoft.Reporting.WebForms.ReportParameterInfoCollection = objRV.ServerReport.GetParameters
    For Each oRptParam As Microsoft.Reporting.WebForms.ReportParameterInfo In oRptParams
        Dim strName As String = oRptParam.Name
        Dim blnPromptUser As Boolean = oRptParam.PromptUser
        Dim blnVisible As Boolean = oRptParam.Visible
        lstParams.Add(oRptParam)
    Next
    Return lstParams
End Function

I have also tried this using LocalReport instead of ServerReport but it didn't help. As you can see from the report parameter properties in Report Builder there is a parameter set to hidden.

enter image description here

nuander
  • 1,319
  • 1
  • 19
  • 33
  • Don't you need to get the `value` of the parameter? I think you are just getting `true` back that the property of the parameter exists in the report. Make sense? I'm just stabbing at this one. – SS_DBA Apr 13 '17 at 19:37
  • @WEI_DBA they are parameter object properties so no, they evaluate to Boolean property values, nice idea tho – nuander Apr 13 '17 at 22:10

0 Answers0