Symptom
In Crystal Reports XI, when a running total on a field is created and a formula is written based on a shared date variable, the first record is ignored in the running total.
The following workflow is performed:
-
Create a running total in the report based on a numeric field.
-
Create a formula in the Use a formula option in the running total.
-
Use a shared date variable in the formula.
When the report is refreshed then the first record is ignored in the running total.
Cause
This behavior occurs because shared variables use the same memory block to store the value of a variable throughout the main report and all of its subreports. Shared variables are even more general than global variables.
To use shared variables, the variable must be declared and assigned a value before it can be passed between the main report and the subreport.
In this example, there is no need to use a shared variable as there are no subreports.
Global variables use the same memory block to store a value throughout the main report. This value is then available to all formulas that declare the variable, except for those in subreports. The solution is to use a global variable.
Resolution
To resolve the behavior, create a formula and declare a global variable in it similar to the following:
Global dateVar dReportFor
:= DateValue(2007,12,4);
dReportFor;
Use this formula in the running total instead of using a formula containing a shared date variable.
Keywords
First record is ignored in running total while using a shared date variable in the formula of running total , 6924959 , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Bug Filed