Report Inheritance

16 posts, 0 answers
  1. Benson
    Benson avatar
    31 posts
    Member since:
    May 2007

    Posted 17 May 2007 Link to this post

    I want to build a base Report form "BaseReport" (Inherits Report), so that I put "Company Name", "No. of pages", etc. inside. Then all reports are inherited "BaseReport" so as to make report layout consistent. But I failed.

    Any hints?

    Benson.
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 18 May 2007 Link to this post

    Hi Benson,

    We have attached a sample solution which will show you how to work with a BaseReport as a template for other reports.

    There are some guidelines that should be followed in order to achieve this scenario.

    First of all, there should be at most one Detail, PageHeader, PageFooter, ReportHeader and ReportFooter section in the two reports (base and inheriting) taken together. GroupHeaders and GroupFooters for a given group can also appear in only one of the two reports. However, if one report contains a group, the other can contain another group. In other words these sections should appear only in one of the two reports. In our example we have deleted the Detail section from the base report by hand, since the inheriting report will supply it. See MyBaseReport class inside the BaseReport project. Note that this report is without a Detail section - you have to manually delete the Detail section and all lines from the code associated with it.

    After that, create a report that will later inherit from the base report. Remove all of its sections except the Detail section.
    While you are designing the report in the designer it still has to inherit form Telerik.Reporting.Report. When you are done with the design, comment out the original class declaration line and replace it in the following manner:
    //  public partial class Report1 : Report
        public partial class Report1 : BaseReport.MyBaseReport
        {
            public Report1()

    ... 
    The code above is for the case when you compile the application. If you want to design the inherited report again, switch back to the original line:
        public partial class Report1 : Report
    //  public partial class Report1 : BaseReport.MyBaseReport
        {
            public Report1()
    ...
    When you are done designing, inherit from MyBaseReport, build, and run your application.
     

    Best wishes,
    Rossen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft banner
  4. ahmed
    ahmed avatar
    2 posts
    Member since:
    Jun 2010

    Posted 14 Jun 2010 Link to this post

    Does the limitation above still exist? (I wanted to be able to design a base report with a header/company logo, etc...and still have a report header in my inherited reports).

    Thanks.
  5. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 15 Jun 2010 Link to this post

    Hi Ahmed,

    If by the "limitation" you refer to the problem with the Report Designer on inherited report, the answer is yes. The problem proved to be hard to resolve and a solution cannot be easily applied without major changes in the designer. For the time being, please use the suggestion of my colleague, namely design your report as you would normally do, and when you are done designing, inherit from MyBaseReport, build, and run your application.

    Sincerely yours,
    Steve
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  6. ahmed
    ahmed avatar
    2 posts
    Member since:
    Jun 2010

    Posted 15 Jun 2010 Link to this post

    I was referring to the following information in this thread:
    "there should be at most one Detail, PageHeader, PageFooter, ReportHeader and ReportFooter section in the two reports (base and inheriting) taken together."

    Is it still true that at most one of the above elements can exist in a report (base and inheriting taken together).
  7. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 15 Jun 2010 Link to this post

    Hello Ahmed,

    Yes this still holds true, but it is not a limitation, rather the actual design of Telerik Reporting. If you check the Understanding Report Sections help article, you would notice that only a single instance of either one of those sections can be added to a report and it does not make any difference whether it is an inherited report or not.

    Best wishes,
    Steve
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  8. Kiran
    Kiran avatar
    10 posts
    Member since:
    Sep 2013

    Posted 27 Sep 2013 Link to this post

    Hi,

    I would like to use the same thing, share header, company name, pagenumber etc.

    I have read the post created by Benson, as he mentioned, he has deleted the detail part from basereport manually, can you please explain how to delete the detail section, I am not able to delete from designer, I tried to delete from designer.cs manually which is throwing errors


    please explain

    Thanks
    Kiran
  9. Stef
    Admin
    Stef avatar
    3050 posts

    Posted 02 Oct 2013 Link to this post

    Hi Kiran,

    Please take a look at my colleague's explanation and attached sample project. Basically, find all references of the detail section and remove them from the designer's generated code. Rebuild the project and check the result in the designer's preview.

    Let us know if you need any further help.

    Regards,
    Stef
    Telerik

    Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

  10. Kiran
    Kiran avatar
    10 posts
    Member since:
    Sep 2013

    Posted 16 Oct 2013 Link to this post

    Hi,

    As you said,i deleted the appropriate reference from designer.cs of master file.

    I need to share

    Here is my master
    pageheader
    pagefooter

    this is inherited report
    detail

    Now when I inherit the report
    its displaying like this

    pageheader
    pagefooter
    detail,

    Please advise, I want detail in between pageheader and pagefooter

    Thank you for your all support and help

    Kiran
  11. Kiran
    Kiran avatar
    10 posts
    Member since:
    Sep 2013

    Posted 16 Oct 2013 Link to this post

    oops

    i found the solution. it was something misunderstood by me


    thanks
    kiran
  12. Rick
    Rick avatar
    9 posts
    Member since:
    Aug 2015

    Posted 18 Apr Link to this post

    Is it possible to achieve this same structure and result using the standalone report designer?
  13. Stef
    Admin
    Stef avatar
    3050 posts

    Posted 19 Apr Link to this post

    Hi Rick,

    In the Standalone Report Designer, you can create templates. These templates can be used on starting a new report, which allows you to reuse existing design and settings.

    Other approach is to create a Master-Detail scenario, where different content can be loaded in a SubReport item placed in the report which design has to be re-used.

    Regards,
    Stef
    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
  14. Mark
    Mark avatar
    35 posts
    Member since:
    Oct 2014

    Posted 19 Apr Link to this post

    We started using the report inheritance idea, but we found an issue.  Any Telerik report that is inherited from another Telerik report, for what ever reason, when you make a change, save it, close the form and then open it again, adds style sheets.  We were trying to figure out why performance we getting worse and worse with these reports and this is one reason. The one report had 50+ style sheets in it, nothing we added. performance gained after remove the style sheets was over 400% faster for the report to display.  Again, not sure what is causing this issue, be we might try out the stand alone report designer for our reports, but if performance is still bad with that, we might have to try a different solution for our reports.
  15. Rick
    Rick avatar
    9 posts
    Member since:
    Aug 2015

    Posted 19 Apr in reply to Stef Link to this post

    Thanks, Stef. I successfully created a template and am able to use that for future report generation. (I have also used the master/detail approach for other scenarios).

    My hope was that a template could be used for multiple reports such that a change to the template would be reflected in each report that utilizes that template (like an ASP.NET master page). I have read multiple posts on this and it does not appear possible, at least via the Standalone Report designer.

    If we switch to the Visual Studio Designer, would it be possible to accomplish this via code? Based on Mark's comments in the latest post, it appears there may be issues with this approach as well. What do you recommend?

  16. Rick
    Rick avatar
    9 posts
    Member since:
    Aug 2015

    Posted 19 Apr in reply to Mark Link to this post

    Thx, Mark. Good to know. We have experienced several limitations imposed by the Standalone Report Designer. It seems to be geared toward a less technical audience and is therefor less customizable since it's GUI based. We are considering moving to the Visual Studio Report Designer to gain more flexibility by working with the C# code. I will say we haven't noticed any performance issues on the front end.
  17. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 21 Apr Link to this post

    Hello Rick,

    When the report inherits from a custom class instead of Telerik.Reporting.Report you will lose the design-time support for this report in the Visual Studio report designer.
    Thus, we recommend to inherit from the default Telerik.Reporting.Report class while designing and saving the report. Once you are done you can change the inheritance to apply your custom class as a template. This should help avoiding the issue described by Mark in his last reply.

    Regards,
    Nasko
    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
DevCraft banner