Solved

Suppressing Sub Report

Posted on 2010-11-10
25
1,445 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:GiaHughes
  • 12
  • 5
  • 5
  • +1
25 Comments
 
LVL 37

Expert Comment

by:TommySzalapski
Comment Utility
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
 

Author Comment

by:GiaHughes
Comment Utility
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
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 166 total points
Comment Utility
What do the formulas return in the subreport?

They need to print a ""

You can them suppress blank sections in the subreport

mlmcc
0
 

Author Comment

by:GiaHughes
Comment Utility
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
 
LVL 37

Expert Comment

by:TommySzalapski
Comment Utility
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
 

Author Comment

by:GiaHughes
Comment Utility
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
 
LVL 34

Expert Comment

by:James0628
Comment Utility
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
 

Author Comment

by:GiaHughes
Comment Utility
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
 

Author Comment

by:GiaHughes
Comment Utility
Hi mimcc
Report attached
Gordon
Purchases-to-Equipment-V2.rpt
0
 

Author Comment

by:GiaHughes
Comment Utility
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
 
LVL 34

Expert Comment

by:James0628
Comment Utility
 > 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:GiaHughes
Comment Utility
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
 
LVL 37

Expert Comment

by:TommySzalapski
Comment Utility
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
 
LVL 34

Expert Comment

by:James0628
Comment Utility
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
 

Author Comment

by:GiaHughes
Comment Utility
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
 
LVL 37

Expert Comment

by:TommySzalapski
Comment Utility
Not sure. That may be the way to go. I use CR 2008 and I've never had this problem.
0
 

Author Comment

by:GiaHughes
Comment Utility
Hi
Do you think it will work with CP XI R2?
Gordon
0
 
LVL 37

Assisted Solution

by:TommySzalapski
TommySzalapski earned 167 total points
Comment Utility
Yes.
0
 
LVL 34

Assisted Solution

by:James0628
James0628 earned 167 total points
Comment Utility
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
 

Accepted Solution

by:
GiaHughes earned 0 total points
Comment Utility
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
 

Author Comment

by:GiaHughes
Comment Utility
Excellent support as normal
0
 

Author Closing Comment

by:GiaHughes
Comment Utility
Thanks for all the support
0
 
LVL 34

Expert Comment

by:James0628
Comment Utility
You're welcome.

 James
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now