Crystal Reports - Suppressing a Report Header

Guys,

I have a report built in Crystal Reports 11. In one of the sub reports, I have 1 report header section (with Headings), 1 details section (with records) and 1 Report footer section with some text.
When displaying the records in the Details section I use suppression (in the details section) to hide records I don't want to display, which actually could result in some cases where there are no records to display. If this happens and there are no records being displayed, I want to suppress both the report header section (the headings) and the report footer section (with text).
ie. If my suppression results in no records being displayed then I basically want nothing to be display in the entire sub-report.
There are no groups or running totals to complicate matters.

Anyone any ideas on how to do this.

Cheers,
Andy
AMU1962Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

James0628Commented:
... I have 1 report header section (with Headings) ...
Report header, or Page header?

 How do you suppress the details?  That will determine how, or if, you can suppress the header.

 James
AMU1962Author Commented:
James,

Everything is in a SubReport. The headings are in the Report Header of the subreport.

I suppress rows in the detail section by Right clicking the Details section and selecting Section Expert. I have then selected Suppress(No Drill down) in the common tab, then entered then suppression code into the X-2 formula.

Andy
mlmccCommented:
The report header is built before the detail rows are displayed therefore you don't know how many will be suppressed/displayed.

What are the suppression formulas?
There may be a may be a way to use it to determine a count


I am thinking about a formula like

If NOT(SUPPRESSION FORMULA) then
    1
Else
   0

YOu could summarize that and if the total is 0 then suppress the group header.

mlmcc
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

James0628Commented:
As mlmcc asked, what is the suppression formula?  That's really what I was wondering.  You may be checking something that can't be referenced earlier in the report, like in the report header.

 James
AMU1962Author Commented:
Guys,

Supression formaule is pretty straight forward

{TransactionDetailsTable.FreeText} <> "Purchase"

which is in the X-2 section

I've included an attachment showing the sub report and the supression formula

Thanks again,
Andy
Report-Sub-Section.docx
James0628Commented:
First of all, if you only want to see the "Purchase" records in the subreport, instead of suppressing the detail section, why not just use {TransactionDetailsTable.FreeText} = "Purchase" for the record selection formula?  Does the subreport need to include those other records for some reason (eg. summaries)?

 Anyway, if you're using that formula to suppress the detail section, you could do what mlmcc described.  Create a formula in the subreport like this (let's call the formula purchase_count):

if {TransactionDetailsTable.FreeText} = "Purchase" then
  1
else
  0


 Then the suppression formula in the other subreport sections would be:

Sum ({@purchase_count}) = 0

 That will be true if there are no "Purchase" records in the subreport.


 If you decide to change the subreport to check for "Purchase" in the record selection formula (instead of suppressing the detail section), you could use a formula like the following to suppress the other subreport sections:

IsNull (Count ({TransactionDetailsTable.FreeText}))


 I am assuming that TransactionDetailsTable.FreeText will never be null.  If it could be null, you may need to add something to handle those.

 James

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AMU1962Author Commented:
Thanks James

Funny how sometimes it just takes someone to point out that you can't see the wood for the trees. The record selection solution is the more elegant solution and is exactly what I am looking for.

Thanks to both you and mlncc for your help

Andy
James0628Commented:
You're welcome.

 And, yeah, sometimes my mind just gets set looking at something a certain way and doesn't see an obvious alternative.

 James
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.