SAP Knowledge Base Article - Public

1713575 - How to get the total count only for displayed records

Symptom

Avoid suppressed records count form  total count of records.

Environment

  • Crystal Reports 2008
  • Crystal Reports 2011

Reproducing the Issue

  1. create a report with duplicate data
  2. check “Suppress If Duplicated”  and write the below code in formula editor
     {Field_value} = Previous ({Field_value});.
  3. Place Record Number Special field in Designer
  4. Preview the report

Resolution

  1. Create a formula '@Init' and place it on the Report Header:
    whileprintingrecords;
    numbervar x := 1;
  2. Create a formula '@Row_num' and place it on the Details section:
    WhilePrintingRecords;
    numbervar x;
    if RecordNumber = 1 then
    totext(x,0)
    else if previous({Field_value}) <> {Field_value} then
    (
    x := x + 1;
    totext(x,0);
    )
    else
    ""

Keywords

record number, suppress records , suppress record numbers, crystal reports, Total count for display records, avoid suppress records count , KBA , BI-RA-CR-DSL , Crystal Reports on C++ Data Semantic Layer (ClassicUniverse) , How To

Product

Crystal Reports 2008 V1