LocalReport.SubreportProcessing + BO CSLA + .NET Master / Details / Details / Details

LocalReport.SubreportProcessing + BO CSLA + .NET Master / Details / Details / Details

Old forum URL: forums.lhotka.net/forums/t/7284.aspx


BeyondNet posted on Wednesday, July 15, 2009

Dear Friends

I am using ReportViewer software, Some of you have been able to create complex reports, where there are structures of parents, children and grandchildren.

Private Sub Reporte_SubreportProcessing(ByVal sender As Object, ByVal e As Microsoft.Reporting.WinForms.SubreportProcessingEventArgs) Handles Reporte.SubreportProcessing
        Select Case e.ReportPath
            Case "rptBORastreoAutorizaciones"
                For Each _Vehiculo As RastreoVehiculo In m_Rastreo.RastreoVehiculos
                    e.DataSources.Add(New ReportDataSource("YMS_Libreria_Reporte_Rastreo_RastreoVehiculoAutorizacion", _
                                                         _Vehiculo.Autorizaciones))
                    For Each _Autorizacion As RastreoVehiculoAutorizacion In _Vehiculo.Autorizaciones
                        e.DataSources.Add(New ReportDataSource("YMS_Libreria_Reporte_Rastreo_RastreoVehiculoAutorizacionSecuencia", _
                                               _Autorizacion.Secuencias))
                    Next
                Next
            Case "rptBORastreoSecuencias"

                For Each _Vehiculo As RastreoVehiculo In m_Rastreo.RastreoVehiculos
                    For Each _Autorizacion As RastreoVehiculoAutorizacion In _Vehiculo.Autorizaciones
                        e.DataSources.Add(New ReportDataSource("YMS_Libreria_Reporte_Rastreo_RastreoVehiculoAutorizacionSecuencia", _
                                               _Autorizacion.Secuencias))
                    Next
                Next
 End Select
    End Sub

I have the following structure of objects:

Parent BO
Child A
Child B
Child C
Child D
Child D1
Child D1.1
Child D1.2
Child D2
Child D2.1
Child D2.2


JonnyBee replied on Monday, August 03, 2009

Hi,

ReportViewer must always start on an IEnumerable type - meaning that if your root object is en EditableRoot you must cast it into an IEumerable type.

Nested reports are created as subreports (each list has its own report).

The reportviewer will process ALL the items in the "topmost" IEnumerable list and then run the subreports where You must supply the items to process in the callback function per parent object.

I would recommend you to go to www.gotreportviewer.com and look at the Subreport samples.

/jonnybee

Copyright (c) Marimer LLC