Suppressing Sub Report

I have a main report with 2 sub reports
I am carring data from the sub reports to the main report, using declared values, this is worrking OK
I have placed the sub reports in the group footers.
I would like to suppress the sub reports in the main report where there is no data, but if I do this it will not show the data I am carrying forward, so I get a lot of blank information as can be seen in the attached word doc. The sub reports are currently formated with a line around them as can be seen in the doc
Gordon
Suppress-sub-report.doc
Gordon HughesDirectorAsked:
Who is Participating?
 
Gordon HughesDirectorAuthor Commented:
Hi All

I have used CP XI R2 and the report is now suppressing OK
I have another issue with the report, for which I will raise another question
I will close this particular question
Gordon
0
 
TommySzalapskiCommented:
In the section expert, for each section set the suppression formula to suppress if there is no data. Then set the subreports to suppress if blank. Don't make new sections for each subreport, put them all in the same one and use borders if you want to.

Or just supress the sections each subreport is in if you can get the conditions set right.
0
 
Gordon HughesDirectorAuthor Commented:
Hi
I have set the main report option to suppress printing if no records
Have formated the section to suppress blank section
Have formated the subreports section  to suppress if a totals field isnull
Still will not suppress in the main report
Have also added the 2 subreports into the same section in the main report
Any other suggestion
Thanks
Gordon
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

 
mlmccCommented:
What do the formulas return in the subreport?

They need to print a ""

You can them suppress blank sections in the subreport

mlmcc
0
 
Gordon HughesDirectorAuthor Commented:
Hi mimcc

Good to hear from you
I have shown all the formulae used in the code snippet, using these the totals are working on the report Ok
I have set the details in the sub reports to suppress blanks
The sub reports are in group header #2a and 2b, I have set these to suppress blanks 9formatting the section)
Have also removed the line formatting on the sub reports
But I still get a lot of blank spaces on the report

Gordon
@WODECVAL (in header of first sub report
shared numbervar WOTotalValue;

if isnull (Sum ({PURREQ.TOTAL})) then WOTotalValue:=0.00 else
WOTotalValue:= Sum ({PURREQ.TOTAL})



@EQDECVAL (in header of second sub report)
shared numbervar EQTotalValue;

if isnull (Sum ({PURREQ.TOTAL})) then EQTotalValue:=0.00 else
EQTotalValue:= Sum ({PURREQ.TOTAL})

@DECVAL (in header of main report)
WhilePrintingRecords;
Shared NumberVar WOTotalValue := 0;
''

@DECVAL2 (in header of main report)
WhilePrintingRecords;
Shared NumberVar EQTotalValue := 0;
''

@WOTOTAL (in main report, but not in any section)
WhilePrintingRecords;
Shared numberVar WOTotalValue ;
WOTotalValue

@EQTOTAL (in main report, but not in any section)
(in main report, but not in any section)

@TOTALCOST (shown in group fotter #2)
{@WOTotal} + {@EQTotal}

Open in new window

0
 
TommySzalapskiCommented:
I don't have Crystal on this computer but do you have to set the borders to not show either? That wouldn't make sense, but Crystal Reports rarely does.
0
 
Gordon HughesDirectorAuthor Commented:
Hi TommySzalapski:
CP does work quite like that, on the format sub report you can remove the border by selecting none for each part in the boder options
Have done this and now I just get a lot of blank spaces
Gordon
0
 
James0628Commented:
Do the subreports produce any output that you actually need to see on the main report, or do they just set variables?  If they just set variables, then just suppress all of the sections in the subreports (the formulas in those sections will still be evaluated), set the subreport format to "suppress blank subreport" and set the section that the subreport is in to "suppress blank section".


 > Have formated the subreports section  to suppress if a totals field isnull

 Do you mean a section in the subreports, or the section of the main report that the subreports are in?  If it's the latter, that won't work, because CR decides whether or not to suppress a section before it executes any subreports in that section.  The up side to that is that if the section is suppressed, the subreports won't be executed, which is more efficient.  The down side is that it means that you can't suppress a section based on a variable that's set in a subreport in that section.  The way to get around that is to create a copy of the subreport that just sets the variable and produces no output, and put the copy in the section above the one with the original subreport.  Then you can use the variable to suppress the section that the original subreport is in.  But I don't think that will be necessary here.

 James
0
 
Gordon HughesDirectorAuthor Commented:
Hi James
I tried to remove all the output in the sub reports but it still shows
How are where do I set the subreport format to "suppress blank subreport"

Gordon
0
 
Gordon HughesDirectorAuthor Commented:
Hi mimcc
Report attached
Gordon
Purchases-to-Equipment-V2.rpt
0
 
Gordon HughesDirectorAuthor Commented:
Hi mimcc
If i remove the borders it still does not supprss the the blank data, it means that I just get a lot of blank spaces on the report

Not sure what you mean by "You don't need to click suppress when you provide a formula" and if this would help

Gordon
0
 
James0628Commented:
 > How are where do I set the subreport format to
 > "suppress blank subreport"

 Right-click on the subreport and select "Format Subreport".  On the Subreport tab, check the "Suppress blank subreport" box.  That's absolutely essential if you want to suppress the section that the subreport is in when the subreport is blank.

 You may also have to remove the borders from the subreports.  I'm not sure.

 As for mlmcc's comment about clicking Suppress, I think he's referring to the fact that if you enter a conditional suppression formula (like the one that you used for the Detail section in each subreport), you don't have to also check the Suppress box.  It doesn't do any harm, but it's not necessary.  If you enter a formula, it doesn't matter to CR if the Suppress box is checked or not.  It will use the formula.

 In the end, I guess do whatever seems clearest to you.  Personally, I don't check the Suppress box if I'm entering a formula.

 James
0
 
Gordon HughesDirectorAuthor Commented:
Hi James
On my version of CP 8.5 there is not an option to suppress blank subreport, the tab shows a box for On-Demand subreport  and an option to apply a formula to subreport preview tab options
Hence my comment about how and where to set this option
In the common tab there is a box to select suppress with a formula option, but do not know what to put in the formula to achieve the sme result

Any help, please
Gordon
0
 
TommySzalapskiCommented:
This article explains how to suppress blank subreports in CR 8.5. Start from page 30
http://www.scribd.com/doc/2190438/20-Secrets-of-Crystal-Reports
0
 
James0628Commented:
Ah, sorry.  I haven't used 8.5 and didn't realize that it didn't have that option.  Perhaps the article that Tommy mentioned will help.  If not, I'm not sure what you can do.  There is the idea of making a copy of the subreport and having it set a variable that is used to suppress the section that the original subreport is in, but without a "suppress blank subreport" option, you may just end up having the same problem with the copy of the subreport.

 James
0
 
Gordon HughesDirectorAuthor Commented:
Hi
The article is useful but still get too many blank spaces
Am I better to get a later version of  cp and then would it work
Gordon
0
 
TommySzalapskiCommented:
Not sure. That may be the way to go. I use CR 2008 and I've never had this problem.
0
 
Gordon HughesDirectorAuthor Commented:
Hi
Do you think it will work with CP XI R2?
Gordon
0
 
TommySzalapskiCommented:
Yes.
0
 
James0628Commented:
As Tommy said, CR XI should be fine.  I use CR 10 and I've never had a problem using the "suppress blank subreport" option.

 James
0
 
Gordon HughesDirectorAuthor Commented:
Excellent support as normal
0
 
Gordon HughesDirectorAuthor Commented:
Thanks for all the support
0
 
James0628Commented:
You're welcome.

 James
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.