Search code examples
crystal-reportscrystal-reports-xi

How to suppress entire section of main report when subreport is blank


I have the report designed with following sections.

Report Header

I have added few fields to display report title and other header information followed by a sub report. I hide/show this section with a parameter value and it is working just perfect.

Page Header a

I have the header information here.

Page Header b

I have report title here. Hide/Show this section based on the parameter value

Page Header c

Fields header goes here

Group Header #1

Suppressed

Details

Detailed fields

Group Footer #1

Suppressed

Report Footer a

Blank and suppressed

Report Footer b

I have added few fields to display report title and other header information followed by a sub report.

Page Footer

Blank

I need a way to suppress Page Header a, Page Header b and Page Header c when I’m printing Report Footer b. Because it has its own header. I also need to suppress the entire section of Report Footer b when the sub report is blank. Any suggestion/help greatly appreciated.


Solution

  • I have worked out a solution from within the code. If the data rows for the crystal object is empty then

    CRAXDRT.Report.Sections("RFb").Suppress = True
    

    This solution worked for me. To suppress the main report header for the subreport section when the subreport contains data, placed a formula in the Report footer a

    WhilePrintingRecords;
    global booleanvar no_header := True;
    

    In the section expert set the suppress formula as

    WhilePrintingRecords;
    global booleanvar no_header;
    no_header
    

    for Page Header a, Page Header b and Page Header c Thank you all for your time to respond. I really appreciate it.