I am trying to filter a report from three combobox values. Only selected values should be passed as report parameters. For example an user may select values in two comboboxes and the last one unselected. I have set all three comboboxes to . selectedindex = -1. Also all three parameters in the report is set to allow null and blank values. The report has a tablix and I have set it to filter for all three parameters. However when I run the report the tablix only shows values if I select a value in all three comboboxes. I am using VB.NET.
My code follows :
Code:
Dim stringaliasnaam, stringEZY, stringVB As String
If CmbAliasnaam.SelectedIndex <> -1 Then
stringaliasnaam = CmbAliasnaam.SelectedItem.ToString
Else
stringaliasnaam = Nothing
End If
If CmbEZY.SelectedIndex <> -1 Then
stringEZY = CmbEZY.SelectedItem.ToString
Else
stringEZY = Nothing
End If
If CmbVB.SelectedIndex <> -1 Then
stringVB = CmbVB.SelectedItem.ToString
Else
stringVB = Nothing
End If
Dim param1 As New ReportParameter("ReportParameterAliasnaam", stringaliasnaam)
Dim param2 As New ReportParameter("ReportParameterEZY", stringEZY)
Dim param3 As New ReportParameter("ReportParameterVB", stringVB)
ReportViewer1.Show()
Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter() {param1, param2, param3})
Me.ReportViewer1.RefreshReport()
I think my problem lies in passing the parameter. Any help would be much appreciated.
Regards