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

Suppressing Main Group when Subreport is Blank

Status
Not open for further replies.

LLowrance

Programmer
May 11, 2004
47
0
0
US
CR 8.5 (Can use CR 9 if needed)
SQL Database

I've read other strings regarding this and just cannot get this to work. So I'm starting a new string that perhaps will shed some light on what I'm doing wrong.

I have a main report that is retrieving timers an employee has run per file. A file can have multiple timers. My subreport linked by fileID gathers the file information if it has been open between 30 & 180 days. Files can be opened and closed several times and each instance is called activeperiod with a begin_date and end_date. The sum of those days is in the selection criteria. If the subreport is blank, I need the main group to be suppressed. Here is my layout:

Main Report to Get Hours Billed:

GH1-LoginID
GH2-FileID (subreport here) @TotalHours
D- loginID, Charge_date, Hours
GF2-FileID (Suppressed)
GF1-LoginID (empty, used for spacing)
RF

Subreport to get file data:

GH1-FileID (Suppressed)
D- BeginDate, EndDate, @DaysOpen (Suppressed)
GF1-FileID, ClaimantName, EmployerName, Sum(@DaysOpen)

A loginID can have hours each month but if the file has not been open between 30-180 days, the subreport is blank. If the subreport is blank I need the GH2-fileID on the main report to be suppressed.

HELP! I know it involves a Shared Variable but cannot get it to work.

Thank you,

-LLL
 
You have to add formulas like the following, assuming ID is string (you could adjust it to a numbervar, if necessary):

//{@reset} to be placed in the main report header and in GF2:
whileprintingrecords;
shared stringvar ID := "";

//{@test} to be placed in the GH1 section of the subreport:
whileprintingrecords;
shared stringvar ID := {table.fileID};

In the main report, insert another GH2 section, and move the subreport to GH2a, with your main report GH2 fields in GH2b. Then use a suppression formula on GH2b like this:

whileprintingrecords;
shared stringvar ID;
ID = "";

You can make the subreport disappear by formatting the subreport to "suppress blank subreport", and formatting the GH2a section to "suppress blank section", and by removing the border around the sub. This assumes that nothing displays in the detail section when there is no matching file ID, and the sub detail section should be formatted to "suppress blank section" also.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top