• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 822
  • Last Modified:

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
0
LinInDenver
Asked:
LinInDenver
  • 4
  • 3
1 Solution
 
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
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
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
 
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
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now