'=====================================================================
'  File:     HideParameter.rss
'
'  Summary:  Hides report parameter.
'      May be helpful if parameter has query based default value
'      Report Manager does not support this case 
'
'---------------------------------------------------------------------
' THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
' KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
' IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
' PARTICULAR PURPOSE.
'=====================================================================*/
'
' Variables that are passed on the command line with the -v switch:
' itemPath - the path of the report 
' parameterName - name of the parameter
'
' Sample command line: 
' rs -i HideParameter.rss -s http://localhost/reportserver 
'     -v itemPath="/SampleReports/Report1" -v parameterName="myParameter"
Public Sub Main()
    If ((itemPath is Nothing) or (parameterName is Nothing) ) Then
        Console.WriteLine("Please provide required parameters")
    End If
    Dim Parameters() as ReportParameter
    ' Get report parameters
    Parameters = rs.GetReportParameters(itemPath, Nothing, false, Nothing, Nothing)
    Console.WriteLine("GetParameters successful")
    Dim i as Integer
    For i = 0 To Parameters.length - 1
        If (Parameters(i).Name = parameterName) Then 
           Parameters(i).PromptUser=true
           Parameters(i).PromptUserSpecified=true
           Parameters(i).Prompt=""
           rs.SetReportParameters(itemPath, Parameters)
           Console.WriteLine("SetParameters successful")
           return
        End If
    Next i
    Console.WriteLine("Parameter " & parameterName & " was not found")
End Sub 'Main