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

SUPPRESSING PRINTING OF MAIN REPORT PAGE HEADER IN SUB-REPORT

Status
Not open for further replies.

shaunk

Programmer
Aug 20, 2001
402
AU
I am running Crystal 8.0 against SQL SERVER 2000.

I want to suppress the printing in the subreport of the Page header of the main report.

I have tried setting up a shared variable to pass a value of "True" to the main report when the subreport prints records so the page header prints for the main report but not for the subreport.

The shared variable looks like this in the subreport:

SHARED BOOLEANVAR SUPPRESSFLAG:= TRUE;

and is used in conditional suppressing in "format section"
in the main report's Page Header as:

SHARED BOOLEANVAR SUPPRESSFLAG;

IF SUPPRESSFLAG = TRUE THEN TRUE ELSE FALSE

Basically it doesn't work.
 
Hi, There is a crystal report sample file which can show you how to do this.The name of the file is cr_groups_drilldown_samples.zip. There is a sample report in this file by the name of DrillDown-Fake page Headers.rpt.
Hope this helps
cheers
 
Thanks for the reference. I can see what the sample report is doing but in this case it is operating within the same report.
I need to be able to pass the value of the boolean flag I set in the subreport ( which controls conditional printing of the manin report header) back to the main report before printing of the main report ( or at least printing of the subreport ) takes place.
 
shaunk,
I have the same problem...if you figure it out, can you please share?
Thanks!
 
That's right about where the snake starts to eat it's own tail, you want the main report to know what the subreport has before the main report fires.

Sounds like the main is the sub, to me.

Anyway, one approach might be to place a subreport in the main report header to check for some comdition which disqualifies it, then you can use a shared variable from it to determine suppression.

-k
 
Not so much before the main fires , but before it prints.
I thought there may have been an outside chance that the main and subs execute before any of them are printed. Now I know.
I had placed the subreport in the Main's Report header as suggested and it performs as required. I found I did not have to fool around with any suppress flags...
The question arises as to why subreports don't have Page Header sections, meaning you are forced to use the page header of the main report.
Sometimes you want to create a Main report and a series of subreports that have little in common apart from the date range.
I thought there may have been an elegant way of having the subreports use their own page header.
 
Oh, I forgot to add that I'm running CR9 and facing the same problem...
 
I came up with a hideous solution , but a solution nonetheles.
I created a formula called Page_header that resolved to a value of "Whatever text you want in the Header" for all records returned by the selection criteria.
Example code.

Code:
If 
{contact.start_datetime} >= {?start-date} and
{contact.start_datetime} <= {?end-date} and
{contact.mode_code} in ["C0901","C0902"] and
{contact.org_unit} = {?ORGUNIT} = 

then "This is the header text"

else   ""

This formula constitutes the entire selection criteria used.
I then grouped the subreport by this formula as the first grouping , and set the flag to "repeat header on each page".

It may not work for all circumstances and it is extremely inefficient, but it may be useable in certain situations.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top