ReportViewer1 LocalReport SubreportProcessing event doesn't fire
-
Montag, 23. Mai 2005 20:19from following two posts,
http://groups-beta.google.com/group/microsoft.public.sqlserver.reportingsvcs/browse_thread/thread/e5be66e6f49f9d86/f0191d9dd6e3b558?q=subreport+in+reportviewer+local+mode&rnum=1&hl=en#f0191d9dd6e3b558
http://groups-beta.google.com/group/microsoft.public.sqlserver.reportingsvcs/browse_thread/thread/4e94a8f347b4426d/3cc4e95a2fd850a6?q=subreport+in+reportviewer+local+mode&rnum=2&hl=en#3cc4e95a2fd850a6
I learned I have to wire SubreportProcessing event to make SubReport local mode to work. But my problem is the event can't be fired.
Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("DataSet1", ds.Master))
AddHandler ReportViewer1.LocalReport.SubreportProcessing, AddressOf MySubReportProcessing
Me.ReportViewer1.RefreshReport()
Private
Sub MySubReportProcessing(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
e.DataSources.Add(New ReportDataSource("DataSet1", Me.ds.Child))
End Sub
My report will show data from master table, but subreport only says error.
am I missing something here?
Alle Antworten
-
Freitag, 27. Mai 2005 02:52
You can get that error if the RDL for the subreport cannot be found, or if you haven't supplied data for all the datasets expected by the subreport, or if the main report didn't pass a parameter expected by the subreport. -
Freitag, 27. Mai 2005 03:33
Here's some sample code:
Imports System
Imports System.Data
Imports System.Windows.Forms
Imports Microsoft.Reporting.WinFormsPublic Class Demo
Inherits FormPrivate orderDetailsData As DataTable = Nothing
Private Function LoadOrdersData() As DataTable
' Load data from XML file
Dim dataSet as DataSet = new DataSet()
dataSet.ReadXml("OrderData.xml")
return dataSet.Tables(0)
End FunctionPrivate Function LoadOrderDetailsData() As DataTable
' Load data from XML file
Dim dataSet as DataSet = new DataSet()
dataSet.ReadXml("OrderDetailData.xml")
return dataSet.Tables(0)
End FunctionPrivate Sub DemoSubReportProcessingEventHandler( _
ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
If orderDetailsData Is Nothing Then
orderDetailsData = LoadOrderDetailsData()
End If
e.DataSources.Add(New ReportDataSource("DataSet1_OrderDetails", orderDetailsData))
End SubPublic Sub New
me.Text = "Report Control Demo"
me.ClientSize = new System.Drawing.Size(700, 500)Dim reportViewer as ReportViewer = new ReportViewer()
' Set Processing Mode
reportViewer.ProcessingMode = ProcessingMode.Local
' Set RDL file
reportViewer.LocalReport.ReportPath = "Orders.rdlc"
' Add a handler for SubreportProcessing
AddHandler reportViewer.LocalReport.SubreportProcessing, _
AddressOf DemoSubReportProcessingEventHandler' Supply a DataTable corresponding to each report data source
reportViewer.LocalReport.DataSources.Add( _
new ReportDataSource("DataSet1_Orders", LoadOrdersData()))' Add the reportviewer to the form
reportViewer.Dock = DockStyle.Fill
me.Controls.Add(reportViewer)' Process and render the report
reportViewer.RefreshReport()
End SubPublic Shared Sub Main(args as string())
Application.Run(new Demo())
End Sub
End Class -
Freitag, 27. Mai 2005 12:58
Rajeev, Thanks for the replies.
You are right, my subreport had error. It would be nice in the final version we can see some error message when compiling or runtime.
I have another question.
I am doing like your demo code. a little differnent is I fill my dataset first, which include two datatables for all of the masters and details. Then in subreportprocessing event, I use details datatable.select to filter details by the e.parameter. I design it this way assuming it is much faster than going to database to get detail every time subreportprocessing fires.
But the performance is very bad, it took almost 5+ seconds to run 20+ master rows, 100+ detail rows report. It seems the botteneck is the every datatable.select statement.
What is your suggestion? From the RS BOL, I know performance is better to use data region than subreport. But it should not be that worse, I think I am doing something wrong here.
Wei -
Freitag, 27. Mai 2005 18:08One thing you can try is to do the filtering in RDL instead of doing datatable.select. In my sample code I am supplying the same data each time the SubreportProcessing event fires, and then using a filter expression in the subreport RDL. You should still try to avoid subreports if you can, for performance reasons.
-
Freitag, 27. Mai 2005 19:03Filter in RDL of subreport does help improve performance. But still not good enough, I said it takes 5+ seconds if I use datatable.select, now I think I under estimated it. I would say it takes 10+ seconds if use datatable.select, 5+seconds if use filter in subreport.
So it is a improvement. But still not good enough compared to my Access report. You know I am importing 150+ reports from MS Access. The same report in access only takes 2- seconds. Something can be done to improve the subreport performance, maybe the engine, maybe RDL of my report. don't know. -
Montag, 11. Juni 2007 21:31
Hi all,
I was reading this thread (as I struggle to get subreports working) and something in this response confused me. You wrote that some possible reasons that the subreportProcessing event isn't being triggered could be:
You can get that error if the RDL for the subreport cannot be found, or if you haven't supplied data for all the datasets expected by the subreport, or if the main report didn't pass a parameter expected by the subreport.
Here's what I don't understand: Isn't the whole point of the subreportProcessing event firing is that that's the point at which I should take the currently selected values of the parent report parameters in order to fetch the data for all the datasets expected by the subreport?
Then again, I still haven't been able to get that event to fire, so I might be way off.
Thanks for your time in advance,
Jeremy
-
Mittwoch, 7. März 2012 23:07
hello
I hav the same problem, I need to use a subreport to show some detail for every row on the main report, and I got "
- An error occurred during local report processing.
- Value cannot be null. Parameter name: value
"
I dont know why , my situation is
the sub reoprt is in the same directory than the main report
the subreport request 2 parameters in order to call some bussines object and fill the data, I will do this in the ReportViewer1.LocalReport.SubreportProcessingThe event NEVER raise,.. I guess because the error
do u have some complete example , so I can download to really understand how to work with subreports?
THANKS IN ADVANCESalu2 Sergio T
- An error occurred during local report processing.
-
Freitag, 11. Mai 2012 14:08
C# 2010 SP1,
Hi there,
I have the same issue.
My Parent report is fine. My Child report1 is fine as well (Has data), but I do not know how to fire reportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(ContactSupplierProcessingEventHandler);
Please helpAlex
-
Montag, 14. Mai 2012 20:57
Never mind i Found it
Alex
- Als Antwort vorgeschlagen Alex_00 Montag, 14. Mai 2012 20:57
-
Mittwoch, 23. Mai 2012 23:21
If you have a ReportViewer.Reset, your AddHandler must follow it.
ReportViewer1.Reset()
AddHandler ReportViewer1.LocalReport.SubreportProcessing, AddressOf LocalReport_SubreportProcessing

