Using section report as sub report in header of another report

Posted by: anatekar on 27 July 2018, 4:37 am EST

    • Post Options:
    • Link

    Posted 27 July 2018, 4:37 am EST

    Hello,

    We are going to be creating multiple reports using section reports. All these reports will have a common header. The header is not static and will have fields that are bound to data coming from the datasource.

    I created a section report called MainReport, then another section report called HeaderReport.

    Then added bound fields to the detail section of the HeaderReport

    Then I added a subReport control to the PageHeader of MainReport and set the HeaderReport to the Report field of the subReport control.

    The problem is that only the first page of the report shows the data from the sub section report. the subsequent pages do not have the page header.

    I also tried adding the bound fields to the GroupHeader and set the property of the group header to OnPageIncludeNoDetail of the HeaderReport instead of having them in the Detail section, but it still does not work.

    Only way I can get it to work if if the HeaderReport has static data in the group header section.

    I want the header to be reusable between multiple reports and have data bound from a datasource. Any thoughts or ideas on how to do this will be helpful. I am using AR 12.

    Thanks

    Amit

  • Posted 29 July 2018, 4:13 pm EST

    Hello Amit,

    Could you please explain your requirements in more detail:

    1: Header Report and Main Report bound to the same database or different databases?

    2: How much data is header report have?

    3: Could you please try using PageHeader Format event. Please use the following code in a script section of the report

    
    GrapeCity.ActiveReports.SectionReport rptSub;
    public void ActiveReport_ReportStart()
    {
    	//Create a new instance of the generic report
    	rptSub = new GrapeCity.ActiveReports.SectionReport();
    	//Load the rpx file into the generic report
    	rptSub.LoadLayout(this.SubReport1.ReportName);
    }
    public void PageHeader_Format()
    {
    		this.SubReport1.Report = rptSub;
    }
    
    

    Thanks,

    Mohit

  • Posted 31 July 2018, 2:25 am EST

    Hello Mohit,

    I found the solution. Instead of binding the fields in the HeaderReport using the DataField property, if I assign value to the textboxes via code behind, then I can use the HeaderReport as a subReport in the page header section of the main report and it repeats correctly with data on all pages.

    I’ve attached an image of what I needed, and what I have done.

    Thanks

    Amit

  • Posted 31 July 2018, 2:25 am EST - Updated 30 September 2022, 9:07 am EST

    Hello Mohit,

    I found the solution. Instead of binding the fields in the HeaderReport using the DataField property, if I assign value to the textboxes via code behind, then I can use the HeaderReport as a subReport in the page header section of the main report and it repeats correctly with data on all pages.

    I’ve attached an image of what I needed, and what I have done.

    Thanks

    Amit

  • Posted 20 March 2024, 5:46 pm EST

    Is this possible to achieve this behavior in Active Report JS?

  • Posted 25 March 2024, 6:25 pm EST

    Hi Ali,

    Unfortunately, you cannot place a SubReport in the header of your Report in ActiveReportsJS. However, you could use a ‘Fixed Layout’ report which repeats the control on every page, so any TextBox bound to your DataSet that you place in your Fixed Layout Report at the top will repeat on every page of the reports.

    Please find attached a sample implementing the same.

    Regards,

    Anand

    SampleReport.zip

Need extra support?

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

Learn More

Forum Channels