none
Pass multiple values to reporting services multi-value parameter RRS feed

  • Question

  • I'm modifying existing code to work with multi-value parameters.  We'd like to retrieve the users' default values for  this parameter from a sql table.  So for instance if they always want to see branch 10 and branch 20, when they run a report these 2 branches are automatically selected and the report runs.  The values will be stored as comma separated values in a field in the SQL table.

    The existing code I need to modify to work with multi-value parameters is this:

    If IsNothing(parm) Then
                    'no existing default for this parm exists, add it
                    parm = New Microsoft.Reporting.WebForms.ReportParameter
                    parm.Name = item.parmName
                    s = item.parmValue
                    parm.Values.Add(item.parmValue) 'only one default parameter is supported at this time
    
                    For Each sitem In ssrsParms
                        If parm.Name = sitem.Name Then 'remove space from parm names
                            If sitem.MultiValue = True Then
                                fields = Split(s, ",")
                                parm.Values.AddRange(fields)
                                rptParms.Add(parm)
                            Else
                                rptParms.Add(parm)          'only add the parm if it is present on the report
                            End If
                        End If
                    Next
                Else
                    'There's already a default for this parameter. Override it
                    parm.Name = item.parmName
                    parm.Values.RemoveAt(0)
                    parm.Values.Add(item.parmValue)
                End If
    
            Next
    

    The code works and inserts a single value into the parameters fine.  What I need to do is pass multiple values in and I'm not sure what I'm doing wrong.  Any ideas ??


    J. Way
    Friday, December 9, 2011 6:53 PM