I'm using Visual Studio 2008 with Visual Basic .Net web forms to display a local report. I am not using SSRS. I am not using Crystal Reports but rather the Microsoft Report Viewer.
I have a series of business data objects which source their data from an xml file. I am attempting to use these objects to display this data in a report.
It seems to work fine if I want to display data at the top level of the hierarchy of data objects, it also works if I want to display an individual record from one of the child collections ie. =Fields!MyCollection.Value
However, I can't figure out how to populate a graph/chart or table with list data based on the same collections...
I have attempted to use basic arrays for the collections and also generic collection objects to no avail.
When attempting to populate a graph no data populates it. When I attempt to populate a table it simply displays the text "#Error"
I have also attempted to use a datatable containing the required data but the report won't allow me to drag the data table property from my datasource onto the report for some reason. I can't see how I could use a datatabe as my source object.
See code snipet for how I am setting up the report data. A couple of things in this method might look strange:
1) I am destroying and replacing the dataview control on the form because the form. The form is set up so the user can choose a report from a treeview from a left pane and it displays in the right pane. There seems to be a bug in the report viewer where it will only display the first report selected. This is my attempt at a work-around.
2) Even though my potentialproperty object is a singular object, I am loading it into a collection so that the object I am parsing implements iEnumerable. Not sure if this is the best way of doing things but it seems to work.
Thanks in advance,
Private Sub LoadReport(ByVal strReportPath As String)
Dim rpv As Microsoft.Reporting.WinForms.ReportViewer
rpv = New Microsoft.Reporting.WinForms.ReportViewer()
rpv.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
rpv.LocalReport.ReportPath = strReportPath
Dim col As Collection = New Collection
rpv.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("DataLayer_PotentialProperty", col))
If Not rvReportViewer Is Nothing Then
rvReportViewer = Nothing
rvReportViewer = rpv