AR12: Can't cast Designer to SectionReport

Posted by: mike on 10 March 2018, 6:58 am EST

    • Post Options:
    • Link

    Posted 10 March 2018, 6:58 am EST

    I’m working with AR12 trial to evaluate an upgrade from AR10. In AR10, I reworked your EndUserDesigner into a multi-tabbed editor which relies on the ability to new up a Designer.

    We work exclusively with SectionReports, but code that once worked in AR10 is now giving unexpected runtime errors. The following code used to work just fine:

    var page = new TabPage("SomeTabIndexName");
    var designer = new Designer();
    var sectionReport = (SectionReport)designer.Report
    sectionReport.Script.Language = "VB.NET";
    //etc., etc.
    

    It compiles fine, since the Designer’s .Report is an object at compile time. However, at runtime it suddenly becomes a PageReport and cannot be cast into a SectionReport. The Designer’s ReportType is read-only, and there are no constructors to allow me to specify a ReportType.

    Am I doing something wrong, or is this an unintentional breaking change in AR12? How can I new up a Designer for use with SectionReports?

  • Posted 11 March 2018, 4:09 pm EST

    Hello,

    This occurs since the designer tries to open a RDL report by default. If you set the default report to open as a Section Report to avoid above issue. You can use the following line of code.

    
    var page = new TabPage("SomeTabIndexName");
    var designer = new Designer();
    designer.NewReport(DesignerReportType.Section);
    var sectionReport = (SectionReport)designer.Report
    sectionReport.Script.Language = "VB.NET";
    
    

    Hope it helps.

    Thanks,

    Mohit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels