Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Shared NumberVar Problem Post Reply Post New Topic
Author Message
dpanders
Newbie
Newbie


Joined: 28 Apr 2011
Online Status: Offline
Posts: 8
Quote dpanders Replybullet Topic: Shared NumberVar Problem
     Posted: 09 Jan 2013 at 8:58am
I am having a problem with a Shared NumberVar returning an incorrect value to the main report.

I placed a sub-report from which I am calculating the denominator for patients admitted to our hospital in the Report Header a. In the sub-report, I have the following declaration:

Shared NumberVar Initial_Denom := Sum ({@Initial Count})

This value is displayed at the bottom of the sub report (for error checking purposes). Right now it is showing a value of 4,167 (obviously varies with selection parameters).

In the Main Report, I call the Shared NumberVar in Group Header#1a with the following formula:

WhilePrintingRecords;
Shared NumberVar Initial_Denom;
Initial_Denom:=Initial_Denom

It is returning a value of 4303. There are no other calculations, summaries, etc. that I can find to explain why nearly 200 additional records are being added to the Shared NumberVar between the Sub and the Main.

Any insight would be welcomed.

Darren P. Anderson, MSN, RN

Manager, Utilization Management
Vidant Medical Center
2100 Stantonsburg Road
Greenville, NC 27834

Phone (252) 847-2402
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 09 Jan 2013 at 11:35am
if those are the only 2 places that the shared variable is being used,  I would try creating a new section for groupHeader 1, and move it to the top...making it the new groupHeader1a. Then I would place the subreport in the new groupHeader 1a, and run the report and see if the discrepancy still exists.
 
also as a note, you don't need Initial_Denom:=Initial_Denom, just Initial_Denom in the display of the shared variable.
 
The other thing that you could try, would be to double check the values in the subreport or manually look at the data and see which number is right (hopefully 1 of them). This might also guide you to what is going on in the report.
 
while I don't think is happening, if you displayed a total before the last grouping was in, you would see a difference, and yet the report would be complete correct, the difference being just a logical choice of when to view the values.
 
HTH
 
IP IP Logged
dpanders
Newbie
Newbie


Joined: 28 Apr 2011
Online Status: Offline
Posts: 8
Quote dpanders Replybullet Posted: 25 Jan 2013 at 8:38am
Will try the new group header. I have already manually verifed the Sub Report - it is correct. It just gets messed up coming back into the main.
Darren P. Anderson, MSN, RN

Manager, Utilization Management
Vidant Medical Center
2100 Stantonsburg Road
Greenville, NC 27834

Phone (252) 847-2402
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum