Jeff
Jeff

Reputation: 8138

Reporting Services Dynamic Parameter Contents Based on Other Parameter Settings

Is it possible in reporting services to populate a parameter based on a value selected in another parameter? We are looking at replacing a set of existing reports in a legacy reporting platform that does this a lot.

Upvotes: 0

Views: 27335

Answers (2)

vick
vick

Reputation: 1

Public Shared Function RemoveDuplicates(parameter As Parameter) As String() Dim items As Object() = parameter.Value

    System.Array.Sort(items) 

    Dim k As Integer = 0

    For i As Integer = 0 To items.Length - 1
        If i > 0 AndAlso items(i).Equals(items(i - 1)) Then
            Continue For
        End If
    items(k) = items(i)
    k += 1
    Next

    Dim unique As [String]() = New [String](k - 1) {}
    System.Array.Copy(items, 0, unique, 0, k)
Return unique

End Function

Public Shared Function BuildList(ByVal variableName As String, ByVal paramValues As Object()) As String Dim insertStatements As New System.Text.StringBuilder() For Each paramValue As Object In paramValues insertStatements.AppendLine(String.Format("INSERT {0} VALUES ('{1}')", variableName, paramValue)) Next Return insertStatements.ToString() End Function

Public Function createLabel(ByVal month AS Integer, ByVal index AS Integer) AS String Dim year AS Integer = Now.Year

If month <= 0 Then
    month   = month + 12
    year    = year - 1
End If

If month - index > 0 Then
    Return MonthName(month - index) & " " & year
Else 
    Return MonthName(month  + (12 - index)) & " " & year -1
End If

End Function

Public Function createValue(ByVal month AS Integer,ByVal index AS Integer) AS String Dim year AS Integer = Now.Year

If month <= 0 Then
    month   = month + 12
    year    = year - 1
End If


If month - index > 0 Then
    Return RIGHT("0" & month - index,2)  & year
Else 
    Return RIGHT("0" & month  + (12 - index),2)  & year -1
End If

End Function

Upvotes: 0

Russ Bradberry
Russ Bradberry

Reputation: 10865

Please reference this question. Updating report parameters based on parameter selection? (SSRS)

Upvotes: 3

Related Questions