I would like to add te selected values of a multivalued parm to the header of my report. E.g. I have a drop down with doctors loaded with a sql data source where doctorid (Guid) is the value member, and name (string) the display member. In my report I want to show the selected doctors or all available in case of no selection. I do not want to show the guids (obviously) but the names...
Yet, only the value members are accessible, where I would like the get my hands on the display members.
This is my (working) code:
Basically I do an extra query to the database to get the paramater datasource values (again!), and compare them against the selected value members.
But as you can see, it is not very generic... It's per parameter because I need to cast the report to access the parameter data source and the specific parameter data source properties. A separate function for each multivalued parameter with a separate database call...
The selection variable contains an ArrayList(Of string) These are casted value members of the parameter data source {CStr(VoorschrijverID)} The result of this function is a string with the names of the doctors semicolon separated.
My question is: Is there a more easy way to do this? Preferably without the database call and accessing the parameter data source directly.
Regards,
Raoul
Yet, only the value members are accessible, where I would like the get my hands on the display members.
This is my (working) code:
Public Shared Function VoorschrijverLabels(ByVal selection As Object(), ByVal reportItem As Object) As String Dim labels As String = String.Empty Try Dim processingReport As Telerik.Reporting.Processing.Report = TryCast(reportItem, Telerik.Reporting.Processing.ReportItemBase).Report Dim report As rptDagstaat = TryCast(processingReport.ItemDefinition, rptDagstaat) Dim da As New SqlDataAdapter(report.dsVoorschrijvers.SelectCommand, report.dsVoorschrijvers.ConnectionString) Dim ds As New DataSet da.Fill(ds) For Each row As DataRow In ds.Tables(0).Rows If labels.Length > 0 Then labels += "; " If selection Is Nothing OrElse selection.Contains(row("VoorschrijverID").ToString) Then labels += row("Voorschrijver") End If Next Catch ex As Exception End Try Return labels End FunctionBut as you can see, it is not very generic... It's per parameter because I need to cast the report to access the parameter data source and the specific parameter data source properties. A separate function for each multivalued parameter with a separate database call...
The selection variable contains an ArrayList(Of string) These are casted value members of the parameter data source {CStr(VoorschrijverID)} The result of this function is a string with the names of the doctors semicolon separated.
My question is: Is there a more easy way to do this? Preferably without the database call and accessing the parameter data source directly.
Regards,
Raoul