Blank space problem when sub-report has no data

Posted by: rdt on 28 September 2017, 3:59 am EST

    • Post Options:
    • Link

    Posted 28 September 2017, 3:59 am EST

    [activereports_archive]

    I have about 30 sub-reports on a report.



    Since there is not apparent feature for all sub-reports below a given sub-report to “move up” the page if the above sub-report is empty, I have resorted to making all the sub-reports about 2 pixels high and they expand appropriately as needed, and then I hide any sub-report that has no data.



    However, when there are several sub-reports in a row that have no data, there’s too much blank space and I’m getting complaints from the users.



    Has anyone else had to deal with this issue, and does anyone know of a solution?



    I don’t see how you could “look-back” onto a previous page and possibly move a whole sub-report onto the previous page, when the events that are provided are for the current page…or is there another way?

    [/activereports_archive]

  • Posted 28 September 2017, 3:59 am EST

    [activereports_archive]

    I spent some time on these types of issues, here’s what I did…



    All of that white space is coming from the size of the section, not the empty subreports.  When you drop a subreport control onto a report it’s default CanShrink property is set to true, make sure this is the case.



    I had several sections that had multiple sub reports, so what I did was create a new group header for each sub report.  This way I could make the subreport very tiny and shrink down the group around it.  This did the trick for most of my cases, and in other areas where I knew that I would not be using a sub report I set the whole group visible = false.  The poitn is, if you have a section 3 inches tall, with 3 subreports that yield nothing (regardless of the subreport control heights) you still get all that white space, so get rid of it! :slight_smile:



    Hope those help,

      NJR

    [/activereports_archive]

  • Posted 13 March 2022, 11:26 pm EST

    19 years later, Is there a better solution for this issue. We are still using this type of solution in our section reports and it looks ugly to the users.

  • Posted 14 March 2022, 8:30 pm EST

    Hi Mark,

    An alternative way to do this is to set the CanShrink property of the SubReport control to True and in the sub report use the NoData() event of the SectionReport to set Visible to False for each section in the subreport. This would set the Sub Report control’s height to zero when there is no data in the subreport control.

    Please refer to the following lines of code:

    private void Report_NoData(object sender, EventArgs e)

    {

    reportHeader1.Visible = false;

    reportFooter1.Visible = false;

    }

    To learn about NoData event please refer to the following page of our documentation:

    ActiveReports 6 page: https://help.grapecity.com/activereports/webhelp/Legacy/ActiveReports6/webframe.html

    ActiveReports 15 page: https://www.grapecity.com/activereportsnet/docs/v15/online/report-events.html#:~:text=user%20designer%20control.-,NoData,-This%20event%20occurs

    For reference, I have attached a sample made using ActiveReports 15 along with.

    Hope it helps.

  • Posted 14 March 2022, 8:31 pm EST

    It seems that the sample didn’t go through in the previous reply.

    SubReportNoDataSample.zip

Need extra support?

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

Learn More

Forum Channels