?
Solved

Suppress subreport when detail is conditionally suppressed

Posted on 2012-09-17
6
Medium Priority
?
790 Views
Last Modified: 2012-09-18
In Crystal Reports for VS 2008, I have a subreport that prints detail records for a child table only when a field is within a range (date during the current year, for instance). I want to suppress the subreport if no records fit the range. I've checked Suppress Blank Subreport in the Format Editor, and if the child table has no records at all matching the parent record, the subreport doesn't appear. If there are records which are simply outside the range, though, the subreport appears with no records displayed.

It seems that "conditionally suppress all records" isn't the same thing as "blank report." Any ideas on how to accomplish this?
0
Comment
Question by:ElrondCT
  • 2
  • 2
  • 2
6 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 38408075
If there are no records that meet the criteria you need to ensure the subreport doesn't display anything.

That includes all labels, headers, etc.

mlmcc
0
 
LVL 20

Author Comment

by:ElrondCT
ID: 38408156
How do I get header labels to display if there is information and not display if there are no records? I'd prefer to display them in the subreport, but would be OK with doing it in the main report, too.

Alternative solution: Is there any way to set the subreport link to include the range test? All I can see is exact matches.
0
 
LVL 35

Accepted Solution

by:
James0628 earned 2000 total points
ID: 38408487
Sure, you should be able to do the range test in the subreport.  It sounds like you're just looking at the subreport link screen.  You can create the links there to pass your parameters or formulas or whatever, and link them to something in the subreport, and then open the subreport and go to Report > "Selection Formulas" > Record and change the formula to whatever you want.  The things that you linked from the main report will be parameters in the subreport, which you can use like any other parameters.  Or, if your range is just calculated based on the current date, you can just do the same calculation in the subreport record selection formula.

 James
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
LVL 101

Expert Comment

by:mlmcc
ID: 38409485
What filtering of records is the subreport doing that is not part of the record selection?

Can that filtering be done in the record selection so you only get the records you want?

mlmcc
0
 
LVL 20

Author Comment

by:ElrondCT
ID: 38409512
Perfect, James! That gave me exactly what I needed. Thanks!
0
 
LVL 35

Expert Comment

by:James0628
ID: 38412547
You're welcome.  Glad I could help.

 James
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 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