SAP Knowledge Base Article - Public

1198685 - Manual running total shows incorrect value in Crystal Reports

Symptom

  • Summary incorrect.
  • Manual running total returns incorrect value when added to a Group Footer section in Crystal Reports.

Environment

  • SAP Crystal Reports 2008
  • SAP Crystal Reports 2011
  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016

Reproducing the Issue

  1. In Crystal Reports, create a report off any data source.
  2. Insert a group.
  3. Create formulas to calculate the group total using variables.
       
    Notice the variable displays the wrong values in the Group Footer.

Cause

  • This behavior occurs because the evaluation time function WhilePrintingRecords is omitted, or the variable value was not reset.

Resolution

  • A manual running total consist of 3 formulas, a reset, accumulate and display formulas, and the formulas will looks like:
        
    • Reset formula: ( Added to the Report Header, or Group Header section )

      WhilePrintingRecords;
      NumberVar myVariable := 0;   // Set, or reset the value to zero.
         
        
    • Accumulate or Evaluate formula: ( Generally added to the Details section, but could be other sections depending on the requirement )

      WhilePrintingRecords;
      NumberVar myVariable := myVariable + 1
         
    • Display formula: ( Added to the Group Footer, or Report Footer section )

      WhilePrintingRecords;
      NumberVar myVariable
           
             
  • To return the correct summary values when using a manual running total:
      
    1. Ensure the formulas starts with the evaluation time function: WhilePrintingRecords
        
    2. Ensure each formulas are inserted in the right sections. 
        
      For example:
            
      If you have a group total, insert the reset formula in the Group Header section, the Evaluate in the Details section, and the Display formula in the Group Footer section.

Keywords

manual running total variable whileprintingrecords while printing records , 2965170 , KBA , BI-RA-CR , Crystal Reports designer or BusinessViews Manager , Problem

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports 2011 ; SAP Crystal Reports 2013 ; SAP Crystal Reports 2016