ReportBook with empty report

4 posts, 0 answers
  1. perico
    perico avatar
    25 posts
    Member since:
    Dec 2006

    Posted 25 Sep Link to this post

    Hi,
    Is there a way to remove empty reports from a ReportBook ?

    Thank you

     

    Before R1 of telerik reporting, I was doing something like this :

     

    If Not TryCast(myRptBook.Reports(4), ReportLibrary1.Report1) Is Nothing Then : If Not DirectCast(myRptBook.Reports(4), ReportLibrary1.Report1).haveData Then myRptBook.Reports.Remove(myRptBook.Reports(4))
    End If

    With 

    Private Sub detail_ItemDataBound(sender As Object, e As EventArgs) Handles detail.ItemDataBound
        Me.haveData = True
    End Sub
  2. Yana
    Admin
    Yana avatar
    4603 posts

    Posted 28 Sep Link to this post

    Hello Pierre,

    The provided snippets seems correct and I will need some more information on the exact scenario you have in order to test the case - could you let me know what errors you're experiencing with R1 release? What was the version you had before the upgrade? Do you use ItemDataBound event for all the data items in the report?

    I'm looking forward to your reply.

    Regards,
    Yana
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. perico
    perico avatar
    25 posts
    Member since:
    Dec 2006

    Posted 29 Sep Link to this post

    Hello Yana,

    my problem is that since R1, it's not recomanded to use reportbook.report.

    API Changes: ReportBook
    The property Telerik.Reporting.ReportBook.Reports is now obsolete. Please use Telerik.Reporting.ReportBook.ReportSources property instead.
    The property Telerik.Reporting.ReportBook.ReportParameters is now obsolete. Please use Telerik.Reporting.ReportBook.Parameters property instead.
    The property Telerik.Reporting.ReportBook.PageSettings is now obsolete. Please use Telerik.Reporting.Report.PageSettings property instead.

     

    So my question is : is it possible to delete empty reports in a reportbook using reportsources property instead of reports ?

     

    Thank you

  4. Yana
    Admin
    Yana avatar
    4603 posts

    Posted 04 Oct Link to this post

    Hello Pierre,

    Please excuse me for missing this.  Indeed, with R1 release the Reports collection property is replaced by ReportSources property. So, in your case, you could use InstanceReportSource to add the reports to the ReportBook and after that you could easily get a reference to each report and check its haveData value through its ReportDocument property.

    I hope this will be helpful.

    Regards,
    Yana
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top