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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

suppressing empty sub-reports

Status
Not open for further replies.

HowardHammerman

Instructor
Oct 11, 2001
640
US
I have a linked sub-report that lives in a group footer sub-section. Some groups have the data that links to the subreport, some don't. I place the sub-report in a sub-section and I want to supress that sub-section when the count of the records in the sub-report is zero. I am able to do this with shared variables, but only by creating another sub-report that counts the records and reports the result to a shared variable. I place this sub-report and variable in a sub-section above the one in which I want the sub-report to be displayed.

I notice that shared variables can only be accessed after the sub-report that creates them is processed.

Is there a better way to do this? There must be....

thanks,

Howard Hammerman,
Crystal Training and Crystal Material
On-site and public classes
Low-cost telephone/email support
FREE independent Crystal newsletter
howard@hammerman.com
800-783-2269
 
I actually like this way Howard. The "test" subreport doesn't have to be a mirror image of the real one. It can just look for key values and report back via shared variable as to whether or not to run the real one (ie suppress the section with the real subreport

Jim Broadbent
 
Crystal 8.5 makes the decision to print or suppress a section, before it evaluates the subreport. So you can't get round this except the way you described.

Enough people have been over this one, if there were some other solution, I think we'd have heard.

Madawc Williams
East Anglia, Great Britain
 
In Crystal 9, (but unfortunately not 8.5), right click on the subreport, Format Subreport, Subreport tab, click 'Suppress Blank Subreport'.
 
GMcNamara,

Good idea. But what if the sub-report has text objects in it? Would it be still be considered blank if there were no linked records but text objects? Thanks in advance.

Howard Hammerman,
Crystal Training and Crystal Material
On-site and public classes
Low-cost telephone/email support
FREE independent Crystal newsletter
howard@hammerman.com
800-783-2269
 
That is a good point. I ran a quick test and I expected the text objects to appear but they don't. The subreport simply doesn't process. Works like a charm.
 
I have the same problem in reverse and would appreciate some help. Here is the scenario. I have in a main report the following: ID NAME GIFTAMOUNT. In the subreport I have PledgeAmount and GIFTID. I put in a conditional suppression to supress the subreport if the PledgeAmount is less than 250. I now want to suppress the entries on the main report if the subreport is blank, and in this scenario, the subreport would be blank. There is no correlation between a gift(main) and a pledge(subreport) So how can I accomplish the suppresion on the main report based on a blank subreport?
 
If the subreport is in a section above the information you want to conditionally suppress in the main report, you can use shared variables to handle the suppression. Just use the same condition that you used to suppress the subreport to set the value of the shared variable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top