I have a report that has 3 datasets.
DS1 – Region Number, District Name/Number, Test Name, Test Count, Test Charge for last month
DS2 – Region Number District Number, Test Number, MMYYYY, Test Count, Test Charge for last year, grouped by MMYYYY
DS3 – Region Number Test Number, MMYYYY, Test Count, Test Charge for last year, grouped by MMYYYY
Report Layout
Region Name (GroupHeader)
District Name(GroupHeader)
Test Name (Details Section)
District Chart, bar chart of the last 12 months activity for a district/test combo (DS2) (GroupFooter)
Region Charts (GroupFooter –(the number of charts can be 1 to 20 based on the district data))
Each dataset contains all the respective data & I perform a RowFilter to get the subset of data needed for the District Chart.
The issue I am having is when the Region charts are generated (the number of charts can be 1 to 20 because it is summarizing the districts totals), the charts display the correct number of times, but all the charts displays the data from the last RowFilter.
Other than the Main report, I have tried combinations of the Format & ReportStart Events. I have stepped through the code & the RowFilter is executed for each PanelNumber.
The Code is below....
Main Report
Private Sub grpRegionFooter_Format(sender As System.Object, e As System.EventArgs) Handles grpRegionFooter.Format
Dim rpt As New rptDetailExpRegion_Graph
Dim iWhere As String = txtRegion.Value.ToString.Trim
Dim WhereClause As String = "Region = " + iWhere.Trim
SubReport2.Report = rpt
rpt.DataTable = dsGraphData.Tables(2)
rpt.Where = WhereClause
rpt.Text = txtRegion.Text
End Sub
SubReport 1 (rptDetailExpRegion_Graph)
Private Sub rptDetailExpRegion_Graph_ReportStart(sender As Object, e As System.EventArgs) Handles Me.ReportStart
Dim Panels As DataTable
Dim DR As DataRow
Dim WhereClause As String = Where
Panels = DS.DefaultView.ToTable(True, "PanelNumber")
Panels.DefaultView.Sort = "PanelNumber"
For Each DR In Panels.Rows
Dim rpt As New rptDetailExpRegion_Graph2
WhereClause = Where + " AND PanelNumber = " + DR.Item(0).ToString
srRegionGraphs.Report = rpt
rpt.Where = WhereClause
DS.DefaultView.RowFilter = WhereClause
rpt.DataSource = DS.DefaultView
rpt.DataSource = DS.DefaultView
rpt.DataTable = DS
Next
End Sub
SubReport 2 – Has the graph (rptDetailExpRegion_Graph2)
Private Sub GroupHeader1_Format_1(sender As System.Object, e As System.EventArgs) Handles GroupHeader1.Format
Dim WhereClause As String
WhereClause = "Region = " + txtRegion.Text + " and PanelNumber = " + txtPanelNumber.Text
ds1 = New DataView(DS, WhereClause, "Region", DataViewRowState.CurrentRows)
srRegionGraphs.DataSource = ds1
End Sub