cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Crystal Reports - Issue With Shared Variables

Former Member
0 Likes
3,704

I am having an issue with shared variables that are going from my subreport to my main report. In my subreport I want to pass the sum of the formula ActualCFS and the count of field tbnatur.desc to my main report. I will focus on just one of these, as whatever the problem is with one seems to be the same problem with the other. In a nutshell, these formulas give me exactly what they should when they are on the subreport, so I feel they are working properly. The problem is that the value that is passed to the main report for both formulas are both exactly 554 short of what they each should be.

I have this formula in my subreport:

Shared NumberVar CountCFS;
CountCFS := CountCFS + Sum ({@ActualCFS});
CountCFS;

I have this formula in my main report:

Shared NumberVar CountCFS;
CountCFS

Again, when I place the formulas on the subreport they are correct. But the values on the main report are both short of what they should be by 554 and I absolutely cannot figure out why.

View Entire Topic
abhilash_kumar
Active Contributor
0 Likes

Hi Seth,

Could you please try these:

1. Create a formula @disp_shr to display the value of the shared variable on the Main Report's group:

shared numbervar CountFS;

Place this on Group Footer#1.

2. Create a reset formula and place this on the Group Header:

shared numbervar CountFS := 0;

3. Does the @disp_shr formula show the correct value for each group the subreport runs for?

4. If yes, modify the @disp_shr formula to:

shared numbervar CountFS;
shared numbervar gtot;
gtot := gtot + CountFS;

5. Create one final formula to display the grand total and place this on the Report Footer:

shared numbervar gtot;

-Abhilash