Hide Main section in Crystal report if the Sub Reports are empty

Posted on 2007-11-14
Last Modified: 2008-03-10
I would like to know how to hide the main section in a report based on the sub reports not having any data to display.
Question by:iaintarr
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 28

Accepted Solution

bdreed35 earned 250 total points
ID: 20280387
Are you talking about the section that the subreport is in in the main report?
If so, you need to set 2 things.
First, right click the subreport and choose Format Subreport in the popup.
Click the Subreport tab, then set the property "Suppress Blank Subreport", then click ok.
Second, go into the Section Expert in the Main report, click on the section name that the subreport lives in, and set the property "Suppress Blank Section"
LVL 101

Expert Comment

ID: 20280464
That works if the main section is empty.

You need to get the result from the subreport before the section you need to suppress otherwise the section has already started to display and can't be suppressed except in the case of suppressing a blank section.

Is there a query that will determine if the subreport will be empty?


Author Comment

ID: 20280476
No. I am talking about the main detail section in the main report, this section has two sub report detail sections, each with a sub report in them.
I can suppress the subreport detail sections if they do not contain data, but if both sub reports are supressed due to not having data in them, i would like the main detail section, which they fall under, in the main report to be suppressed.
Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.


Author Comment

ID: 20280489
mlmcc, the query is the one way i have done it, but would rather have less of a noose around the queries neck.
Was just wondering if there is indeed a way to supress the main section based on the sub reports
LVL 101

Assisted Solution

mlmcc earned 250 total points
ID: 20280601
As far as I know we have given you the 2 ways.  Is there information in the detail section before the subreport?

If not you may be able to have multiple detail sections.
Put the subreprots in the first detail section then based on a shared variable that returns whether there was data in the subreport and supress the subdetail section based on that.


Author Comment

ID: 20280628
i shall do the shared variable approach, see what happens.

Expert Comment

ID: 20592587
Forced accept.

EE Admin

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question