Results in nested subreports

5 posts, 0 answers
  1. Geejay
    Geejay avatar
    45 posts
    Member since:
    Feb 2007

    Posted 30 Sep 2008 Link to this post

    Hello telerik team,

    I am building a Master-detail-detail-etc. report but I'm  having difficulties in showing the right results in subreports. I'll try to explain the problem:
    I do something like this in a property in the MasterReport: 

    Dim

    objReport1 As New SubReportClass
    objReport1.ConnectString = ConnectString
    objReport1.DateID = DateID
    objReport1.StudentID = StudentID
    objReport1.ID = value
    Me.SubReport1.ReportSource = objReport1 


    The detailsection shows the results. Works fine.
    In subReport1 I want to show another subreport which uses an ID from recordresults from the MasterReport.
    In DetailSection1_ItemDataBinding in subReport1 I do:

    Dim

    section As Processing.DetailSection = (TryCast(sender, Processing.DetailSection))Dim dataRowView As DataRowView = TryCast(section.DataItem, DataRowView)
    Dim objReport2 As New SubReportClass2
    objReport2 .ConnectString = ConnectString
    objReport2 .DateID = DatumID
    objReport2 .StudentID StudentID
    objReport2 .GoalID =
    Integer.Parse(dataRowView("ID").ToString)
    Me.SubReport2.ReportSource = objReport2

    This shows results but what happens is that the first record of subreport2 shows no results in subreport1 and the second record of subreport2 shows results that belong to the previous record. This how it shows in the ReportViewer. A real print however shows a different result. The first record of subreport2 shows the last record and the second record and further each shows results that belong to the previous record.
    I've tried lots of things so far but I can't find a solution.
    I hope you understand my explanation and can you offer me some help with this.

    Thanks.
    Geert

  2. Hrisi
    Admin
    Hrisi avatar
    221 posts

    Posted 01 Oct 2008 Link to this post

    Hello Geejay,

    According to the report life cycle it is too late to create SubReport2 during the processing stage of the main report. You should first create the report definition (master report, subreport1 and subreport2) and then update master/detail relation at run-time (processing stage). The most appropriate place to update the subreport's binding is in the NeedDataSource event.

    If you have any additional questions, please do not hesitate to contact us again.

    Regards,
    Hrisi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft banner
  4. Geejay
    Geejay avatar
    45 posts
    Member since:
    Feb 2007

    Posted 01 Oct 2008 Link to this post

    Hello Hrisi,

    thanks a lot, that has put me in the right direction! It works correct now in the actual print. The reportviewer however still doesn't show the very first subrecord, althoug all other records are showing correctly now. It's not a big issue, but I know I wil get a lot of questions about this. It's not quit WYSIWYG.

    Regards,
    Geert
  5. Hrisi
    Admin
    Hrisi avatar
    221 posts

    Posted 02 Oct 2008 Link to this post

    Hi Geejay,

    When reports are bound during run-time you should use Telerik.Reporting.Processing namespace to set properties of the report something like this:

    Telerik.Reporting.Processing.Report.DataSource = _already_populated_data

    Maybe this is the reason for the first record of data not to show.

    If you want a more detailed advice how to achieve your goals, please send us the project with some sample data. In this way we can update it to demonstrate how most of the things can be made in design time (WYSIWYG).

    We are looking forward to hearing from you!

    Sincerely yours,
    Hrisi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Geejay
    Geejay avatar
    45 posts
    Member since:
    Feb 2007

    Posted 10 Oct 2008 Link to this post

    Hi Hrisi,

    thank you for your reply. I didn't manage to get things completely working as I want so far, despite your latest remarks. Therefore I'm busy to build an example of my problem as you suggested but it's taking me more time than expected to do that. I will sent you an example as soon as possible.

    Regards,
    Geert
Back to Top
DevCraft banner