Generic Report, but Customized

27 posts, 1 answers
  1. Michael Sumerano
    Michael Sumerano avatar
    18 posts
    Member since:
    Jan 2005

    Posted 01 May 2008 Link to this post

    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?
  2. Answer
    Chavdar avatar
    898 posts

    Posted 01 May 2008 Link to this post

    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,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Michael Sumerano
    Michael Sumerano avatar
    18 posts
    Member since:
    Jan 2005

    Posted 01 May 2008 Link to this post

    It'd be great to have some examples of this either in the online demos or possibly somewhere else.  :)
  4. Rossen Hristov
    Rossen Hristov avatar
    2477 posts

    Posted 02 May 2008 Link to this post

    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,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Kevin
    Kevin avatar
    2 posts
    Member since:
    Nov 2008

    Posted 24 Nov 2008 Link to this post

    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.
  6. Steve
    Steve avatar
    10940 posts

    Posted 27 Nov 2008 Link to this post

    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,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Jason
    Jason avatar
    4 posts
    Member since:
    Jun 2008

    Posted 11 May 2009 Link to this post

    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?
  8. Steve
    Steve avatar
    10940 posts

    Posted 12 May 2009 Link to this post

    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,
    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.
  9. mzn developer
    mzn developer avatar
    68 posts
    Member since:
    Jul 2005

    Posted 27 Aug 2009 Link to this post

    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?

  10. Svetoslav
    Svetoslav avatar
    649 posts

    Posted 31 Aug 2009 Link to this post

    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,
    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.
  11. Zbyněk
    Zbyněk avatar
    3 posts
    Member since:
    Sep 2010

    Posted 02 May 2011 Link to this post

    Can I ask you how this issue seems like now ?

    Best regards
    Zbyněk ŠULC
  12. Steve
    Steve avatar
    10940 posts

    Posted 05 May 2011 Link to this post

    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.

    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
  13. Simo
    Simo avatar
    5 posts
    Member since:
    Oct 2010

    Posted 07 Sep 2011 Link to this post

    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.

  14. Shawn Krivjansky
    Shawn Krivjansky avatar
    88 posts
    Member since:
    Jan 2010

    Posted 31 Aug 2012 Link to this post

    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.
  15. Hrisi
    Hrisi avatar
    221 posts

    Posted 06 Sep 2012 Link to this post

    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\ 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.

    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 >

  16. Shawn Krivjansky
    Shawn Krivjansky avatar
    88 posts
    Member since:
    Jan 2010

    Posted 06 Sep 2012 Link to this post

    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).
  17. Vishal
    Vishal avatar
    5 posts
    Member since:
    Sep 2012

    Posted 25 Sep 2012 Link to this post


    Can you please send me the sample code for it ?

  18. Steve
    Steve avatar
    1885 posts
    Member since:
    Dec 2008

    Posted 17 Dec 2012 Link to this post

    So...I'm guessing this is still not doable since focus seems to be 100% on the standalone designer?
  19. Andrew
    Andrew avatar
    2 posts
    Member since:
    May 2012

    Posted 01 May 2013 Link to this post

    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?
  20. Stef
    Stef avatar
    3610 posts

    Posted 03 May 2013 Link to this post

    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.

    the Telerik team

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

  21. Lasse
    Lasse avatar
    58 posts
    Member since:
    Oct 2010

    Posted 28 Oct 2015 in reply to Michael Sumerano Link to this post

    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;
    08.namespace MyReporting
    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.    }
    24.    /// <summary>
    25.    /// Initializes a new instance of the <see cref="BaseReport"/> class.
    26.    /// </summary>
    27.    public BaseReport()
    28.    {
    29.    }
    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);
    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);
    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.    }
    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.    }
    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.  }

  22. Lasse
    Lasse avatar
    58 posts
    Member since:
    Oct 2010

    Posted 28 Oct 2015 in reply to Lasse Link to this post

    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;
    09.namespace MyReporting
    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();
    23.      // Make the BaseReport do its initialization
    24.      InitializeBaseReport();
    25.    }
    26.  }

  23. Ronan
    Ronan avatar
    2 posts
    Member since:
    Apr 2017

    Posted 07 Sep 2017 Link to this post

    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. 


  24. Katia
    Katia avatar
    694 posts

    Posted 12 Sep 2017 Link to this post

    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.

    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
  25. ids
    ids avatar
    7 posts
    Member since:
    Jun 2019

    Posted 16 Jul 2019 Link to this post

    Dear Support ,

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

    Regards .

  26. Nidal
    Nidal avatar
    20 posts
    Member since:
    Apr 2019

    Posted 16 Jul 2019 Link to this post

    Dear Support ,
    Could any one help me to make base report and sub report at design time using telerik report designer .
    Regards .
  27. Todor
    Todor avatar
    407 posts

    Posted 19 Jul 2019 Link to this post

    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.

    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