SAP Knowledge Base Article - Public

3123316 - How to always show a minimum number of rows on a report in Crystal Reports?

Symptom

  • How to always display a minimum number of row on a report?
  • In Crystal Reports, how to always print a mimimum number of rows on a report regardless the report returns no data, or only few rows?
      
       
  • Note: Images and sample report data in this SAP Knowledge Base Article is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

Environment

  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016 
  • SAP Crystal Reports 2020

Resolution

  • Insert the number of sections equal to the minimum number of rows to display, and conditionally suppress it based on the number of data returned on the report. For example: If we want to always have a minimum of 7 rows:
    1. Open the report in Crystal Reports.

    2. In the Report Footer section, add the  number of new sections equal to the minimum number of section to display, minus one. In this example, add 6 sections. ( You will then have 7 Report Footer sections )

    3. Right click on the first Report Footer section ( Report Footer a ) and select "Section Expert"

    4. In the "Section Expert" under the "Common" tab, click on the "X-2" button of the option "Suppress (No Drill-Down)"

    5. Enter a formula to suppress the section depending on the number of data the report returns, like:

      If Count(<INSERT A DATABASE FIELD HERE>) < 7 Then
         False
      Else
         True

    6. In the upper right corner, click "Save and close" to accept the change

    7. Back on the report, right click on the second Report Footer section ( Report Footer b ) and select "Section Expert"

    8. Enter a formula to suppress the section depending on the number of data the report returns.
      In this second formula, you subtract by one the number total of rows. For example if the minimum to display is 7,
      then the second formula will be comparing the number of value to 6, like:

      If Count(<INSERT A DATABASE FIELD HERE>) < 6 Then
          False
      Else
          True

    9. In the upper right corner, click "Save and close" to accept the change

    10. Repeat steps 7 to 9, for all the other Report Footer sections.

      For the scenario where there is actually no data on the report, we need to suppress the Details section, to do so:

    11. Right click on the Details section, and select "Section Expert"

    12. In the "Section Expert" under the "Common" tab, click on the "X-2" button of the option "Suppress (No Drill-Down)"

    13. Enter a formula to suppress the section depending on the number of data the report returns, like:

      If isnull(count((<INSERT A DATABASE FIELD HERE>) )) Then
           True
      Else
           False

    14. In the upper right corner, click "Save and close" to accept the change

      Now the report will alway display a minimum of rows, and if there is more rows, like 10, 15 or more, it will display all the rows.

  • Sample reports demonstrating the above technique is available in the Attachments section: Minimum Number of Rows.rpt

Keywords

KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To

Product

SAP Crystal Reports all versions

Attachments

Minimum Number of Rows.rpt