Blank space problem when sub-report has no data

Originally Posted 13 November 2003, 11:37 pm EST

  • Originally Posted 13 November 2003, 11:37 pm EST

    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?

  • Reply

    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! :)

    Hope those help,
      NJR

  • Reply

    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.
  • Marked as Answer

    Reply

    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.
  • Reply

    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