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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

supress section based on another section

Status
Not open for further replies.

klaidlaw

Programmer
May 28, 2008
140
US
I am using crystal 11 release 2

I want to supress Group Footer 2b in my report when Group Header 2b is supressed in my report. Group Header 2b is set to to be suppressed when section is blank. If anyone could help be I would appreciate it!!
 
What causes Group Header 2b to be blank?

If its because a field isnull, then use that to switch a boolean var.

You can then use that boolean var to to suppress your footer. Don't forget to reset booleanvar otherwise all subsequent GrpFooters will be suppressed.

Ian
 
The group Header is blank because I subreport is there and when it is blank I wanted the whole section to be suppressed. I did go to the boolean variable, but I do not know how to reset the formula for subsequent grpfooters. If you could tell me how to do that I would really appreciate it!
 
This is what I tried:

In the group header of the subreport I put these two formulas:
//@Suppress
whileprintingrecords;
booleanvar flag := true;

and a shared variable to carry it to the main report:
//@SharedSuppress
Shared BooleanVar Suppress;
Suppress := {@suppress};

In the main report there is
//@Reset groupheader 2a
whileprintingrecords;
Shared booleanvar flag := false;

//@Suppress GroupFooter2a
Shared BooleanVar := Suppress;
Suppress

//@SuppressFooter GroupFooter2b
whileprintingrecords;
booleanvar flag := false;

Then on the main report in section expert for Group footer 2b where it says suppress I put this in x->2:

whileprintingrecords;
booleanvar flag;
flag = true


So basically my subreport is in Group Header 2b and when it is blank that section is set to suppress blank sections. If that does not show up I do not want group Footer 2b to show up either, and this works for the first group but I can't get it to reset to work for the rest. I hope more information helps!!
 
klaidlaw:

Only taking a guess on this one, as I am not familiar with CR 11 r2 (I use 8.5 and 10) - but perhaps this will help.

In (unsuppressed) section above GH2b perhaps create a new group section and white-text the formula field so it seems hidden, place the following:
@VariableReset_SuppressGF2b:
whileprintingrecords;
Shared BooleanVar SuppressGF2b:=FALSE;

In the subreport, pick any field from the subreport and check for Null... if null then no records were returned in the subreport.
@VariableSet_SuppressGF2b:
whileprintingrecords;
Shared BooleanVar SuppressGF2b;
IF IsNull({Table.Field}) THEN SuppressGF2b:=TRUE;

On the main report, in the suppresion formula for GF2b, place the following:
GF2b Suppression Formula:
whileprintingrecords;
Shared BooleanVar SuppressGF2b;
SuppressGF2b=TRUE;

I sadly haven't had a chance to test for certain, but hopefully helps in your pursuit of a solution. [smile]


Mike
--------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure, in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
Author R.A. Salvatore via "Drizz't"
 
MCuthill said:
In (unsuppressed) section above GH2b perhaps create a new group section and white-text the formula field so it seems hidden, place the following:

In my experience with older releases of Crystal Reports, formula fields must be in a "visible" section of the report for the Shared Variable fields to fire through. I used the "White-text" on a very small section to essentially hide sections that would normally be suppressed.

Hope this helps. [smile]

Mike
--------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure, in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
Author R.A. Salvatore via "Drizz't"
 
For one thing, you need to consistently identify the named variable flag as "shared". If you don't, it is treated as two different variables.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top