Print Page | Close Window

suppress sub-report when detail count is 0

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=19246
Printed Date: 01 May 2024 at 7:33pm


Topic: suppress sub-report when detail count is 0
Posted By: procto73
Subject: suppress sub-report when detail count is 0
Date Posted: 08 Mar 2013 at 11:53am
Using Crystal XI
I have a specific formatted sub-report, upon calling the sub-report I print specific header information and at the end of the report is specific foot information; neither have anything to do with the detail. While reading thru the detail records (those that meet the match criteria from the main report; ie. customer, addressID matches), I also suppress any detail on the sub-report that has a specific value in a field on the detail. So, I may have 20 detail records that could be printed because they match the sub-report selection criteria but they are suppressed because they have a value in a field that I don't want that detail record to be printed. My problem is that when no detail is actually printed I don't want any of the sub-report to print. As it is now I get the header and footer info without any detail; what I want is the whole sub-report suppressed if no detail at all is printed. The sub-report works fine if at least 1 record is printed.

How can I accomplish this because the sub-report is not blank at this point so suppressing on blank is not working?


-------------
KP



Replies:
Posted By: DBlank
Date Posted: 08 Mar 2013 at 12:02pm
if i understand you, all of this is in the sub report.
You are suppressing detail based on a criteria.
if this criteria is basedo only on data int hat row, create a formula to give a value for 1 if not suppressed and 0 if suppressed
sum that at teh report level
if it is 0 all rows are suppresses so you can suppress the header and footer sections based on that
sum(formula)=0
this in turn makes the sub report "blank"
which allows you to supress the sub report in the main report on that condition


Posted By: procto73
Date Posted: 10 Mar 2013 at 8:30am
Thanks, that did it. I had the counter for the number of records but was trying to pass back to main report to suppress and that did not work. By checking it as you suggested in the sub report worked fine. Thanks for your help!

-------------
KP


Posted By: procto73
Date Posted: 11 Mar 2013 at 3:43am
Ok, have one more issue. Along the same lines, this subreport has a group header that prints at the beginning of the report. It also have a report footer that prints on the last page. It can get 11 detail lines on a page and print a footer if there are only 11 detail records. If there are more than 11, it will print a max of 12 on the page (page overflow) and then go to the next page. On the next page if there is more detail to print it will also print the group header, but if there is no more detail that meets the criteria it only prints the report footer and I need it to also print the group header. How can I accomplish this?

-------------
KP



Print Page | Close Window