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

Generic Report, but Customized

26 Answers 869 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael Sumerano
Top achievements
Rank 2
Michael Sumerano asked on 01 May 2008, 04:46 PM
I have just started working with Telerik Reporting and I was wondering if this will be possible.  We have a need to create a generic report that can be used by several different clients to generate a report for their data, but also showing them their logo and possibly other information specific to them.  Is it possible to make these kinds of modifications dynamically to the report after the generic one has been created?

26 Answers, 1 is accepted

Sort by
0
Accepted
Chavdar
Telerik team
answered on 01 May 2008, 05:47 PM
Hi Michael Sumerano,

Fortunatelly this is quite possible. A Telerik Report is a .net object defined by a class. You can design the common layout and functionality in a base report class and then inherit it as many times as you need to include the modifications. Furthermore you can modify the report at runtime as it is a .net object.

Hope this helps. Let me know if you have any other questions.

Kind regards,
Chavdar
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Michael Sumerano
Top achievements
Rank 2
answered on 01 May 2008, 06:22 PM
It'd be great to have some examples of this either in the online demos or possibly somewhere else.  :)
0
Rossen Hristov
Telerik team
answered on 02 May 2008, 01:20 PM
Hi Michael Sumerano,

We have prepared a small sample project that demonstrates report inheritance. We have a BaseReport that is the common report that will be inherited. The BaseReport contains a TextBox for a product name and a PictureBox for the product logo. Then we have two reports that inherit it (ProductAReport and ProductBReport) and set the values of the textbox and picturebox accordingly. The textbox and picture box are made protected so that inheriting reports can see them and modify their properties. Please examine the provided sample and if you still have any questions do not hesitate to contact us.

Best wishes,
Ross
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kevin
Top achievements
Rank 1
answered on 24 Nov 2008, 10:09 PM
I am currently working with the Telerik reporting trial, but my company should buy some licenses soon. I am working on a reporting framework where every report inherits a base report. As indicated in this thread, it does just work at the code level. The problem comes up when you are working with the designer.

Designing the BaseReport in the designer works as expected.  It is when you open an report inheriting BaseReport that problems start occuring. First I left all 3 default sections in BaseReport up, PageHeader, PageFooter and Detail. When opening the InheritingReport in designer you only see what appears to be a single section at top of page. A little playing with it, and you find that all 3 sections are there. Unfortunately those 3 sections are on top of each other. So the problem is that in the InheritingReport all 3 sections ended up at the top obscuring each other.

The interesting part is if you bring the report up in the report viewer it properly lays things out.  It is just in the designer it all looks messed up.  And it is messed up in a way that makes it unusable for laying out component on the InheritingReport designer.
0
Steve
Telerik team
answered on 27 Nov 2008, 04:43 PM
Hi Kevin,

This is a known issue that is logged in our system for investigation. Unfortunately we have not had the time to research on it yet and it would be left out for a subsequent release.

Sorry for the inconvenience.

All the best,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jason
Top achievements
Rank 1
answered on 11 May 2009, 08:07 PM
Has there been any progress on the issue of the designer being unusable for derived reports?  For us (2009.1 311 trial), the designer is completely empty on the derived report.  As Kevin stated, the report does actually render properly; it's just the designer that is buggy.

We need report inheritance, and the designer has to work on the derived reports.  Without that, I cannot authorize the purchase of this product.  We're impressed with Telerik Reports otherwise, but this is a must-have.  Any news of a fix or even an estimated time frame for a fix?
0
Steve
Telerik team
answered on 12 May 2009, 09:18 AM
Hello Jason,

This issue has not been addressed yet and is in our TODO list. Unfortunately we cannot engage with a timeframe at this point, although we would do our best to have it addressed as soon as possible.

All the best,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
mzn developer
Top achievements
Rank 1
answered on 27 Aug 2009, 09:57 PM
I notice this behavior has not been patched in the latest version of Telerik Reporting afaik.  Any timeframe on when the designer will be fixed when inheriting from a base report?

I am experiencing an issue with a table on my derived report.  My base class defines my header info, and that is working, however I have a table on the derived report in the details section that comes up blank when I derive from my base report.  Once I remove the base derivation and derive from regular Report, my table starts working again. I am not getting any .NET exceptions, and I have walked the code to verify it is indeed setting the datasource to a non-empty dataset.

Any thoughts on why the table in the derived report is not working?

Thanks!
0
Svetoslav
Telerik team
answered on 31 Aug 2009, 02:16 PM
Hi mzn developer,

As previously explained, we are aware of the issue. Because of the complexity of the problem we need some more time to find and implement the best solution.

Once again please accept our apologies for the inconvenience and thank you for the understanding and patience.
 

Best wishes,
Svetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Zbyněk
Top achievements
Rank 1
answered on 02 May 2011, 12:01 PM
Hi,
Can I ask you how this issue seems like now ?

Best regards
Zbyněk ŠULC
0
Steve
Telerik team
answered on 05 May 2011, 01:00 PM
Hi Zbyněk,

The design time issue of inherited reports still stands. There is no specified time frame and once we start working on this task, it would be duly noted in our Roadmap.

Greetings,
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
Simo
Top achievements
Rank 1
answered on 07 Sep 2011, 07:11 AM
Hi,
I have worked with Telerik Reporting for a couple of weeks now and I have a similar need to be able to derive reports from one base report. I created the report normally. Then I copied it in two new reports, BaseReport and ReportContent. Then I delete everything except PageHeader, ReportHeader and PageFooter from BaseReport and delete everything except GroupHeaders, Details, GroupFooters and ReportFooter from the ReportContent. It must be noticed that not all things can be deleted from the designer, they must be deleted from the designer.cs-file.

Everything works fine. BaseReport preview shows the page headers and footers, and ReportContent preview shows the whole report. If the designer shows something wrong, the cause is probably that there is some duplicate section or other duplicate element in either the base or content reports.

If I want to create a new report, I take a copy of the ReportContent and alter the elements there.

Greetings,
Simo
0
Shawn Krivjansky
Top achievements
Rank 1
answered on 31 Aug 2012, 07:52 PM
Is Simo's workaround the only way to do this?

Any progress from Telerik in the last year??

It would seem pretty basic in the world of reporting to have a "template" to work off of for new reports that have the same basic stuff on every report.

Would it be easier/better to use VS item templates to accomplish this?
Haven't tried it, but does anybody think that would work?  Any known issues?

BTW, I have tried the "base class" stuff (without Simo's workarounds) and it would seem fairly unuseable if you need to actually use the designer to customize the derived reports.  I mean... that is the point of a "template" right?  You want to start with something and then customize.  As most have found, the designer of the "derived" report is completely mangled and unrecognizeable.  Moreover, if you try to change what is there (only a report header in my case), it basically duplicates everything from the base report into the derived report which causes errors galore.
0
Hrisi
Telerik team
answered on 06 Sep 2012, 03:26 PM
Hi Shawn,

I really don't understand why you ask to inherit the reports. They are normal CLR types and you can subclass them as you want and they will work. The problem arises when you try to serialize them in xml in order to edit them in our standalone designer. Because your intention is to separate reports - base report and content report, the only possible way to do that is by representing the content as subreport, similar to Master/Detail reports as in our example Invoice report.

Of course you can use VS ItemTeplates, the only overhead is to prepare them. You can use our template in C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Reporting\Telerik_Reporting_Q2_2011.zip as example.
For the upcoming release next month, we would introduce templates for the xml reports created via the standalone designer.

Please, consider using base report as main report and every content part realized as subreport.

Greetings,
Hrisi
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

0
Shawn Krivjansky
Top achievements
Rank 1
answered on 06 Sep 2012, 03:55 PM
I did NOT ask to inherit the reports.

The original post asked about the recommended way to template a report, so the basics of it could be used as a starting point for other derivitive reports.  (headers, footers... common things to all reports).

Telerik then responded with creating a base class and inheriting new reports from it as the "way to do it".

A number of people (myself included) responded that the new (inherited from) reports (that use the base class) are unuseable in the designer (main designer... not talking about stand-alone designer).  If we can't "design" an inherited report, this whole process is useless.

That was our point.

Creating a VS item template is certainly the way to go with this.
Unless you are building reports in code-only, the item template approach is by far the cleanest way to do this (in my opinion).
0
Vishal
Top achievements
Rank 1
answered on 25 Sep 2012, 10:20 AM
Hi,

Can you please send me the sample code for it ?

Thanks
Vishal
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 17 Dec 2012, 07:59 PM
So...I'm guessing this is still not doable since focus seems to be 100% on the standalone designer?
0
Andrew
Top achievements
Rank 1
answered on 01 May 2013, 09:21 AM
I'm new to Telerik but I'm thinking the way to do this is to create custom report controls, one for company header and one for company footer.  Inside the custom control code you would programatically add what sub controls you need for things like title, logo, page number etc.

Then there is no problem with the designer, just create a new report and drop the standard header/footer on.

What do others think of this?  
Has anyone done it?  
Are there any examples of custom report controls especially ones that contain other controls and are resizable etc?
0
Stef
Telerik team
answered on 03 May 2013, 02:47 PM
Hello Andrew,

Extending the report items is not possible in terms of using them design-time. What we can recommend is to use a master-detail scenario, where you have a master report which can be extended by the reports contained within SubReport items. Note: SubReports can be used only in the report sections, not in the page sections.

For an example of master-detail scenario, please check our Invoice Report online demo and if you have selected to install our demos you can find the sample report under C:\Program Files (x86)\Telerik\Reporting Q1 2013\Examples (the default installation folder).

If you want to programmatically create some parts of the report, you can dynamically add features to a report object at run-time. 

I hope this helps.

Greetings,
Stef
the Telerik team

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

0
Lasse
Top achievements
Rank 1
answered on 28 Oct 2015, 11:54 AM
Recently I found myself in the same situation of wanting to implement a BaseReport in which to implement general ReportParameters, so other reports could inherit from this report and automatically get those default parameters.

Needless to say, that would make my life a lot easier as I would be able to manage and maintain those default ReportParameters in one place.

However, when opening the derived report in the VS Report Designer, the parameters from the BaseReport would automatically be added to the Designer.cs file of the derived report, generating a bunch of errors in the report designer, since these ReportParameters already exist.

Today I found this way to work around this issue:

First, implement a BaseReport class inheriting from Telerik.Reporting.Report - see implementation below.

The BaseReport implementation shown here contains an initialization method that must be called after InitializeComponent() in the constructor of your derived report.

That way, the BaseReport will be able to remove any existing parameters (added by the Report Designer’s automatic code generation) before adding the default ones. Since this happens before the Report Designer shows the report, there will be no errors in the Report Designer.

The BaseReport also contains a method for easily getting parameter values, and an example of a property that can be used in code behind in the derived report.

Now you can add a new report or modify an existing one, making it inherit from BaseReport in stead of Telerik.Reporting.Report – while being able to customize the inherited report in the Report Designer.

BaseReport Implementation:

01.using System;
02.using System.Collections.Generic;
03.using System.Configuration;
04.using System.Linq;
05.using System.Web;
06.using Telerik.Reporting;
07. 
08.namespace MyReporting
09.{
10.  public class BaseReport : Telerik.Reporting.Report
11.  {
12.    /// <summary>
13.    /// Gets the MyStringParameter.
14.    /// </summary>
15.    /// <value>The MyStringParameter.</value>
16.    public string MyStringParameter
17.    {
18.      get
19.      {
20.        return GetParameter<string>("MyStringParameter");
21.      }
22.    }
23. 
24.    /// <summary>
25.    /// Initializes a new instance of the <see cref="BaseReport"/> class.
26.    /// </summary>
27.    public BaseReport()
28.    {
29.    }
30. 
31.    /// <summary>
32.    /// Initializes the BaseReport.
33.    /// </summary>
34.    public virtual void InitializeBaseReport()
35.    {
36.      var _parm1 = new ReportParameter();
37.      _parm1.Name = "HiddenStringParam";
38.      _parm1.Type = ReportParameterType.String;
39.      _parm1.Value = "Default value";
40.      AddParameter(_parm1);
41. 
42.      var _dateFrom = new ReportParameter();
43.      _dateFrom.Name = "DateFrom";
44.      _dateFrom.Type = ReportParameterType.DateTime;
45.      _dateFrom.Value = DateTime.Now;
46.      _dateFrom.Text = "From";
47.      _dateFrom.AllowNull = true;
48.      _dateFrom.Visible = true;
49.      AddParameter(_parm2);
50. 
51.      var _dateTo = new ReportParameter();
52.      _dateTo.Name = "DateTo";
53.      _dateTo.Type = ReportParameterType.DateTime;
54.      _dateTo.Value = DateTime.Now.AddDays(1);
55.      _dateTo.Text = "To";
56.      _dateTo.AllowNull = true;
57.      _dateTo.Visible = true;
58.      AddParameter(_dateTo);
59.    }
60. 
61.    /// <summary>
62.    /// Adds the parameter, removing any existing matching parameters.
63.    /// </summary>
64.    /// <param name="parm">The parm.</param>
65.    public void AddParameter(ReportParameter parm)
66.    {
67.      var index = ReportParameters.IndexOf(parm.Name);
68.      if(index > -1)
69.      {
70.        ReportParameters.RemoveAt(index);
71.        ReportParameters.Insert(index, parm);
72.        return;
73.      }
74.      ReportParameters.Add(parm);
75.    }
76. 
77.    /// <summary>
78.    /// Gets the parameter value.
79.    /// </summary>
80.    /// <typeparam name="T"></typeparam>
81.    /// <param name="parameterName">Name of the parameter.</param>
82.    /// <returns>T.</returns>
83.    public T GetParameter<T>(string parameterName)
84.    {
85.      return ReportParameters.Contains(parameterName) ? ReportParameters[parameterName].Value.TypeCastObject<T>() : default(T);
86.    }
87.  }
88.}



0
Lasse
Top achievements
Rank 1
answered on 28 Oct 2015, 12:01 PM

Example of derived report constructor:

01.using System;
02.using System.Linq;
03.using System.ComponentModel;
04.using System.Drawing;
05.using System.Windows.Forms;
06.using Telerik.Reporting;
07.using Telerik.Reporting.Drawing;
08. 
09.namespace MyReporting
10.{
11.  /// <summary>
12.  /// Summary description for DerivedReport.
13.  /// </summary>
14.  public partial class DerivedReport : BaseReport
15.  {
16.    /// <summary>
17.    /// Initializes a new instance of the <see cref="DerivedReport"/> class.
18.    /// </summary>
19.    public DerivedReport()
20.    {
21.      InitializeComponent();
22.       
23.      // Make the BaseReport do its initialization
24.      InitializeBaseReport();
25.    }
26.  }
27.}

0
Ronan
Top achievements
Rank 1
answered on 07 Sep 2017, 11:34 PM

Has the issue with the designer inheriting other reports been resolved?

This is an old post and wanted to double check on if there was an effective patch for inheriting reports. 

Thanks!

0
Katia
Telerik team
answered on 12 Sep 2017, 01:19 PM
Hi Ronan,

If the report inherits from a custom class instead of Telerik.Reporting.Report the design-time support for this report in the Visual Studio report designer will be lost.
We recommend to inherit from the default Telerik.Reporting.Report class.

Other approach is to use a SubReport item to change the content of the report while the master report has a base content.


Regards,
Katia
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
0
ids
Top achievements
Rank 1
answered on 16 Jul 2019, 01:22 PM

Dear Support ,

Could any one help me to make base report and sub report at design time using telerik report designer .

Regards .

0
Nidal
Top achievements
Rank 1
answered on 16 Jul 2019, 01:37 PM
Dear Support ,
Could any one help me to make base report and sub report at design time using telerik report designer .
Regards .
0
Todor
Telerik team
answered on 19 Jul 2019, 07:36 AM
Hi ids and Nidal,

We have answered the same question in the support ticket opened by ids on the topic. For the benefit of our community I will publish the reply also in this thread.

For designing reports you may refer to First Steps articles that demonstrate how to create and set up report. Here are the general steps :
1) Create a report which will be the subreport. 
2) Add the report items in it and save it. Note that the page header and page footer of the subreport are not displayed in the main report.
3) Create the main report.
4) Go to Insert -> Subreport .
6) Right click over it -> ReportSource -> URL or file -> Select a file -> navigate to the destination of the report -> OK.

Regards,
Todor
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
Michael Sumerano
Top achievements
Rank 2
Answers by
Chavdar
Telerik team
Michael Sumerano
Top achievements
Rank 2
Rossen Hristov
Telerik team
Kevin
Top achievements
Rank 1
Steve
Telerik team
Jason
Top achievements
Rank 1
mzn developer
Top achievements
Rank 1
Svetoslav
Telerik team
Zbyněk
Top achievements
Rank 1
Simo
Top achievements
Rank 1
Shawn Krivjansky
Top achievements
Rank 1
Hrisi
Telerik team
Vishal
Top achievements
Rank 1
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Andrew
Top achievements
Rank 1
Stef
Telerik team
Lasse
Top achievements
Rank 1
Ronan
Top achievements
Rank 1
Katia
Telerik team
ids
Top achievements
Rank 1
Nidal
Top achievements
Rank 1
Todor
Telerik team
Share this question
or