Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress Group Header if details suppressed (subreports) 1

Status
Not open for further replies.

msrost

Technical User
Aug 5, 2009
2
US
I have a main report that is grouped by department number. In the Da I have a newhire subreport. This report returns data on surveys that are sent out. I have the subreport joined to the main report on department number, start date, and end date.

In Db I have an exitdata subreport. This report returns data on surveys that are sent out to employees leaving the company. I have this report joined by department, start date, and end date.

The problem that I have is when I set the subreport to suppress blank subreport and then the Da and Db sections to suppress blank section that works fine. But I cannot suppress the GH1b (that has the department number and name) on the main report.

I have created shared variables that capture if there are records in the subreport. These I placed in the Dc and GF1 and they are returning the correct amount. When I suppress the GH1b based on these variables it suppresses the NEXT GH1b or does not suppress the NEXT GH1b based on the previous GF1 totals.

NewHire Subreport is in Da
ExitData Subreport is in Db

I have put in the formulas the following:

(NewHire Subreport)
GF1: {@rec_returned}
whileprintingrecords;
shared numbervar nhCount := 0;
nhCount := Count ({DEPTCODE_V.DEPARTMENT}, {@VP_NAME})

(ExitData Subreport)
GF1b: {@rec_returned}
WhilePrintingRecords;
shared numbervar exCount := 0;
exCount := sum({HR_EXITSURVEY.Q1_1});

(Main Report)
Dc: {@NewHireCount}
WhilePrintingRecords;
shared numbervar nhCount;
nhCount

Dc: {@ExitDataCount}
WhilePrintingRecords;
shared numbervar exCount;
exCount;

GF1: {@Eval_Shared_Var}
whileprintingrecords;
evaluateafter({@NewHireCount});
evaluateafter({@ExitDataCount});
shared numbervar x;
x := 0;
x := ({@ExitDataCount} + {@NewHireCount});

GH1b: (Suppression Function)
EvaluateAfter ({@eval_shared_var});
shared numbervar x;
if x > 0 then
false
else
true

Now if I move the x := 0 to a separate function and put into GH1a and suppress the GH1a section then all of the GH1b sections are suppressed.

It's a runtime evaluation problem. It's like it's printing the group header 1b before processing the subreport and getting the totals for the records even though I'm telling it to evaluate the suppression statement AFTER the function that totals the number of responses is run.

Please help.

If you have any questions, please let me know.

Thank you,

Matt.
 
You must place copies of the subreport in a GH1a section since the test must be processed before GH1b is printed. If you suppress all sections within the subreports and format both subreports to "suppress blank subreport", remove the borders on the subs, and then format GH1a to "suppress blank section", the subs and the section will not be visible. You cannot suppress the subs themselves or the section they are in directly.

-LB
 
The whole point of a header is to have it above the data you want to report. This master report will have at least 4 sub-reports on it. It is disappointing that Crystal would require me to have all 545 departments listed on the master report or to suppress if it's after my data (in a footer???)

I will now have to build a query to look at the information before the sub-report runs to check to see if the header should be there or not.

it's very disappointing that crystal does not have an option to suppress if these sections are suppressed. or too be even able to look at a section as an object.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top