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!

Conditional suppression of report headers 1

Status
Not open for further replies.

SBendBuckeye

Programmer
May 22, 2002
2,166
US
I have a main report with 2 summary subreports that print at the end. The subreports are in report footer b and report footer c respectively.

There is a standard report header that should print at the top of every page in page header a. I have column heading page headers for the main report and the two subreports in page header b through page header d respectively.

How do I conditionally suppress page headers b thru d as I am printing the various parts of the report? I tried using shared variables in a formula and putting the formula in the report footers along with the subreports, but it seems to be evaluated early, not just at report footer printing time which is what I want.

Am I missing something here or is there a better way to do this? Thanks in advance for any help you can give me!

Have a great day!
 
I don't know if this is the best way to do this or not, but the following worked.

The standard report is a detail report with two summary subreports in the report footer sections, one by Physician Name and the other by Physician Specialty. Prompt8 allows the user to specify (D)etail and both summary reports,
(B)oth for summary reports only, (P)hysician Summary only or (S)pecialty Summary only.

All the reports share a standard Page Header and the detail report conditionally prints one HeaderB while the summary subreports conditionally print HeaderC.

I defined a shared variable named NextToPrint and referenced it in the main report and the two different subreports.

I set it up initially in the Report Header like this using a formula variable named Next To Print:

//also set in subreports
shared stringvar NextToPrint;
if len(NextToPrint) > 0 then
NextToPrint
else //this will be true initially in the main report
select {?Prompt8}
case "D" : //Detail and Summary reports
NextToPrint := "Main Report"
case "P" : //Physician Name Summary only
NextToPrint := "Physician Name Summary"
case "S" : //Physician Specialty Summary only
NextToPrint := "Physician Specialty Summary"
case "B" : //Summary reports only
NextToPrint := {@First SubReport}

The subreports also reference it using a variable like so which is setup in the subreport report footer so as not to impact subreport processing in any way:

//Suppress or print various report headers on main report
shared stringvar NextToPrint;
NextToPrint := "Physician Specialty Summary";

or

//Suppress or print various report headers on main report
shared stringvar NextToPrint;
NextToPrint := "Physician Name Summary";

Detail HeaderB is suppressed as follows for summary reports:

//NextToPrint is updated in subreports also
WhilePrintingRecords;
instr(uppercase({@Next To Print}), "SUMMARY") > 0

Summary HeaderC is suppressed as follows for detail report:

//NextToPrint is updated in subreports also
WhilePrintingRecords;
instr(uppercase({@Next To Print}), "SUMMARY") = 0

It took a little playing around to get all the pieces to work. Hopefully this will be helpful to someone else somewhere along the way.

Have a great day!
 
It is really very helpful and helped me a lot.
Thank You ! The day He summons you, you will respond by praising Him, and you will then realize that you had lasted in this life but a short while.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top