Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress Group Header when Details empty

Status
Not open for further replies.

starfry

IS-IT--Management
Apr 22, 2008
4
0
0
GB
Hello,

I am using Using Crystal Reports 2008 and I have a report that runs off a list of people. It is grouped by person and the group header displays the person's name.

The group has two details sections each containing a subreport that may or may not return items for a given person. The main report does not know whether the subreports will or will not return anything.

The database has a lot of people in it that at some point will all have data to be displayed by the subreports but there will always be a significant number of people with nothing to display and the report must not show them at all.

So, I want to suppress display of the group for a person when the subreports are empty: if the subreports return nothing then the group in the main report for that person should not show at all.

I can't rely on data in the main report to decide whether to show or hide a group; it has to be based on the outcome of running the subreports.

I have successfully hidden the subreports when empty and I am now just left with the header: I have used the "suppress blank subreport" option in the subreport "format editor" and the "suppress blank section" in the details section editor.

Currently my report shows a group header for all users (some without details sections beneath). How do I suppress the group headers when the the details sections have been suppressed because they are empty ?

Can this be done with Crystal Reports?

It has been suggested that a shared variable could be used to control header suppression but such a variable would be set by the subreport after the header, which is too late to control display of the header. So, I am hopeful for other suggestions...

Any help much appreciated.

Thanks.

 
The only way I have done this before is to put a hidden subreport in the main report header.

This will effectively produce a list of valid people ids, based on the data to be displayed in the subreports.

This list of IDs can be stored in a shared array.

In your group header suppression formula

whileprintingrecords;
Not({People ID} in shared array People);

Ian
 
Thanks.
I have got it to look like I want using shared variables.

The groups that are empty are still listed in the groups browser. I would ideally like to remove them from here.

Is this possible?
 
I don't think you can because the data is actually there. You are just suppressing the display. You could always hide the group tree.

Failing that you may have to consider building a query which replicates the main report and the test sub report (as a nested query). Use that as a command and then you will only have the customers you want.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top