Search code examples
crystal-reports

Suppress Group Header when no record below


Is it possible to suppress Group header in page 3/8 when group header no record in this page.

Crystal Report


Solution

  • Here it goes a solution for the problem, but you will have to adjust something else to keep the group header repeating for each page.

    The main idea is to simulate the group header as a detail section and show it only together with the first record of the group.

    Step by step:

    1. Create a running total field to count the records in your group: field to summarize = any, type of summary = count, evaluate for each record, reset on change of group. Let's assume the name of this formula is {#RTotal0}.
    2. Suppress your group header.
    3. Create another detail section above your current detail section. So, you will have "Details a" and "Details b". The section "Details a" will simulate the group header.
    4. Open the section expert, choose the section "Details a", open the formula editor for the option "Suppress", and put this formula: {#RTotal0} > 1. That means that this section will be shown only for the first record of the group.
    5. Open the section expert, choose the section "Details" (the parent of "Details a" and "Details b") and check the option "keep together".

    This will solve your problem. But know the group header will not repeat for each page. One way to do that:

    1. Open the section expert for the group header option, open the formula editor for the option "Suppress", put the formula: {#RTotal0} = 1. It means that the group header will suppress initialy, but after a page break, it will show (if you the group is set to print the group header for each page).

    But you may need to adjust it for your case.