Suppress Detail Row if Sub Report returns data

Hi there,

I am doing a data validation report between two systems.

In my detail section I have an account ID displayed from Database A.
Also in my detail section is a sub report linked on account ID (sub report contains data from Database B)
If the sub report returns a match, I want to suppress the entire detail row.

Any ideas on how to do this?
Thanks,
Lin
LVL 14
LinInDenverAsked:
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.

mlmccCommented:
Do you want to see the subreport?

To do this you need to have the subreport before the data n the main report you want suppressed.

mlmcc
0
LinInDenverAuthor Commented:
Basically I want to suppress my detail lines If the sub report (placed on each detail line) returns data.

See attached. Column to the right is actually my sub report.

The two rows outlined in red need to be suppressed from view.

NeedToHide-Red.pdf
0
mlmccCommented:
Try this

Create a second detail section
Right click the detail section in the left margin
Click INSER SECTION BELOW
Drag the main report fields into the new section

In the main report report header add a formula
WhilePrintingRecords
Shared BooleanVar SubHasRecords := FALSE;
''

In the subreport add a formula
WhilePrintingRecords
Shared BooleanVar SubHasRecords;
SubHasRecords := Count({SomeField}) > 0;

''

In the main report conditionally suppress all the fields in the detail sectioin B
WhilePrintingRecords
Shared BooleanVar SubHasRecords;
SubHasRecords

Right click DETAIL SECTION A in the left margin
Click SECTION EXPERT
Set details A to UNDERLAY FOLLOWING SECTION

mlmcc



0
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

LinInDenverAuthor Commented:
Thanks!

This is mostly working...

By doing detail a/b and suppressing the fields, I was left with a lot of  blank pages, so I applied the suppression on my entire detail section.

I now have two records displaying (the ones that need to be synced up in system B).
The weird thing is, only one of them needs to be fixed. The last record on the page should not be there. Any ideas on how to debug?

I'm attaching the report - it is CR2008.
Salesforce.com-MSOs.rpt
0
mlmccCommented:
I think this is it.

I changed to use the 2 detail sections
Added the suppression to the details b
Added SUPPRESS BLANK SECTION to details b

In the subreport
Deleted the page number and the field
Suppressed subreport details section if blank
Formatted the subreport in the main report to suppress a blank subreport

mlmcc
Salesforce.com-MSOs-1-.rpt
0

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
LinInDenverAuthor Commented:
Thanks!!!

I didn't understand the section A/B reasoning - I just found this article - i have to have my variable displayed AFTER the sub report. Now this totally makes sense. Thanks for your help - this is my first need for Shared Variables, so thanks for guiding me through.

"NOTE:
For the shared variable to return the correct value in the main report, you must place @MainFormula in a main report section that is beneath the section containing the subreport. This ensures Crystal Reports evaluates the @SubFormula before @MainFormula. "

http://www.dmgfederal.com/Resources/TrainersTalk/trainerstalk_howto_share_subreport_data_with_main_report.asp
0
LinInDenverAuthor Commented:
You, sir, are a rock star!
0
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.