This is a migrated thread and some comments may be shown as answers.

Report Inheritance

17 Answers 689 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Benson
Top achievements
Rank 1
Benson asked on 17 May 2007, 10:38 AM
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.

17 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 18 May 2007, 03:05 PM
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
0
ahmed
Top achievements
Rank 1
answered on 14 Jun 2010, 04:01 PM
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.
0
Steve
Telerik team
answered on 15 Jun 2010, 11:58 AM
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.
0
ahmed
Top achievements
Rank 1
answered on 15 Jun 2010, 02:19 PM
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).
0
Steve
Telerik team
answered on 15 Jun 2010, 02:55 PM
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.
0
Kiran
Top achievements
Rank 1
answered on 27 Sep 2013, 12:58 PM
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
0
Stef
Telerik team
answered on 02 Oct 2013, 02:06 PM
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.

0
Kiran
Top achievements
Rank 1
answered on 16 Oct 2013, 08:57 PM
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
0
Kiran
Top achievements
Rank 1
answered on 16 Oct 2013, 09:05 PM
oops

i found the solution. it was something misunderstood by me


thanks
kiran
0
RMS-Licenses
Top achievements
Rank 1
answered on 18 Apr 2016, 10:47 PM
Is it possible to achieve this same structure and result using the standalone report designer?
0
Stef
Telerik team
answered on 19 Apr 2016, 09:41 AM
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
0
Mark
Top achievements
Rank 2
Bronze
Iron
Veteran
answered on 19 Apr 2016, 01:26 PM
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.
0
RMS-Licenses
Top achievements
Rank 1
answered on 19 Apr 2016, 04:45 PM

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?

0
RMS-Licenses
Top achievements
Rank 1
answered on 19 Apr 2016, 04:56 PM
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.
0
Nasko
Telerik team
answered on 21 Apr 2016, 02:28 PM
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
0
Derek
Top achievements
Rank 1
answered on 22 Jul 2019, 03:45 PM

This approach only works in specific scenarios; in my case the parent class contains the report parameters and the report datasource, so the report NEEDS those at design time.

Creating a template in the standalone report designer is only half a solution; if you later decide that you want to change something, you need to do it manually in every report that was built from the template. And the inheritance is so incredibly cumbersome;

  • create a new report
  • adjust page settings as necessary (layout, margins, etc). Probably adjust page width too, if you change the margins.
  • Change to inherit from your parent class
  • In my case, probably save and recompile several times in order to view the report parameters from the parent class.

Even then, the process is flaky; parameters get duplicated in the child reports (throwing errors), styles get duplicated multiple times, just a real dog's breakfast.

This is the most expensive development tool we use, and it seems incredible to me that this problem has been acknowledged for almost 10 years with no viable solution. 

0
Milen | Product Manager @DX
Telerik team
answered on 25 Jul 2019, 02:30 PM
Hello Derek,

I am sorry to hear about your experience with our product and indeed, I can understand where the frustration comes from. Given that, I spent some considerable time researching if something can be done in our product in order to suit similar scenarios and add inheritance in our Report Designer. As previous, I came to conclusion that the major technical limitation with inheriting from a custom report is that the CodeDomSerializer serializes in the inherited report every property and child item of the designed report model. This includes the items added to the inherited report itself and the ones inherited from the base report. All this serialized code goes into the inherited report's InitializeComponent method, which leads to items duplication. The code generator doesn't know that there may be duplicated components, e.g. added with a previous design activity over the parent report. This leads to errors and unexpected result at runtime.

That said, this is a perfectly valid scenario, so please log it as a feature request on our feedback portal: https://feedback.telerik.com/reporting/

The only possible workaround I can think of at this stage are:

1) You can create one base report that contains a header section and use a SubReport item to show the changing content. The advantage of this approach, once the content of the subreport is modified, the changes will appear in the other reports. For more details about this approach please check How to: Create a Master-Detail Report Using a SubReport Item help article.

2) When you design the child reports, initially they have to inherit from Telerik.Reporting.Report. Once you are done with adding the extra report items in it, save it and then change them to inherit again from your base reports. The disadvantage is that the parameters, data fields, etc. from the base report will not be visible and it will be necessary to type them manually if necessary to use them in Expressions in the child report.


Regards,
Milen
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
Tags
General Discussions
Asked by
Benson
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
ahmed
Top achievements
Rank 1
Steve
Telerik team
Kiran
Top achievements
Rank 1
Stef
Telerik team
RMS-Licenses
Top achievements
Rank 1
Mark
Top achievements
Rank 2
Bronze
Iron
Veteran
Nasko
Telerik team
Derek
Top achievements
Rank 1
Milen | Product Manager @DX
Telerik team
Share this question
or