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

section suppression formula

Status
Not open for further replies.

DoPLeGaNgA

IS-IT--Management
Aug 30, 2002
9
US
Hi,

I'm using CR10 and I'm wondering if it is possible to suppress a section in a report if a subreport in another section is blank. Is this possible, and if so what would be the correct syntax?
 
Create a shared variable in the subreport that summarizes records in the subreport:

whileprintingrecords;
shared numbervar ID := count({table.ID});

Place this in the subreport footer. Then in the main report, if you have the subreport in a group header_b section, place a reset formula in the GH_a section:

whileprintingrecords;
shared numbervar ID := 0;

Then in the section expert you will be able to suppress any sections below the one where the subreport is executing, e.g., the group footer section, by going to the section expert->group footer->suppress->x+2 and entering:

whileprintingrecords;
shared numbervar ID;
ID = 0;//note no colon

-LB
 
If the section is below the section containing the subreport, it can be done using a shared variable.

If it is a section above the subreport, you cannot do it. A work-round would be to place a tiny copy of the subreport above the section you want to suppress.

This is the general method for Shared Variables:
For a date, put a formula field in the subreport like
Code:
Shared dateVar 
V_Today := {LoadStatus.LastDLoad}
To access it in the main report, create another formula field with
Code:
Shared dateVar 
V_Today := V_Today

If it was a currency value, you'd do it differently, e.g.
Code:
whileprintingrecords;
shared currencyvar SumSaved;
SumSaved:={#TotSaved};
SumSaved
And to access it in the main report, create another formula field with
Code:
whileprintingrecords;
shared currencyvar SumSaved;
SumSaved

Note that the shared variable is only available in the section after the section which contains the subreport.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thank you all for your help. I'll give this a try.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top