Print Page | Close Window

shared Variable help?

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=15553
Printed Date: 02 May 2024 at 8:07pm


Topic: shared Variable help?
Posted By: lowester
Subject: shared Variable help?
Date Posted: 06 Feb 2012 at 8:31am
I have a main report and a sub report
 
On the main report i have a list of people and some other information

In the subreport i have the same list with their indiv copay amounts.

Im using this formula in the subreport
 
Whileprintingrecords;
Shared numberVar n := {billing_plan_assigned.max_monthly_responsibility};
n;
 
And this in the  main report:
 
Whileprintingrecords;
Shared numberVar n;
n;
 
Its pulling data over into the main report its just not linked to the right person from the subreport.  I have the subreport links matching the person ID..
 
Any suggestions on where i messed up?

Thanks
 



Replies:
Posted By: DBlank
Date Posted: 06 Feb 2012 at 8:45am
in the main report are you placing the shared variable on a section below where the subreport runs?
e.g.
DetailsA - subreport
DetailsB - shared variable


Posted By: lowester
Date Posted: 06 Feb 2012 at 8:51am
I have Details A - which contains the subreport
          Details B - which contains the shared Variable
 
It keeps pulling the wrong shared variable value for the record on the main report
 
Thanks!


Posted By: DBlank
Date Posted: 06 Feb 2012 at 10:42am

are you seeing the 'correct' value in the main report in detail A (displayed from then subreport in the subreport)?



Posted By: lowester
Date Posted: 07 Feb 2012 at 2:10am

yes - in detail A the subreport is showing the correct data.. but in detail B where the shared variable is.. its not pulling the correct value for each person..



Posted By: DBlank
Date Posted: 07 Feb 2012 at 4:00am

hmmm, seems odd. Can you tell if the value is consistently from another row or some other consistently derived value?

try adding another formula in the main report to set the value to 0
and place that in detail a, subreport in detailb and variable in detall c. 


Posted By: lowester
Date Posted: 07 Feb 2012 at 5:01am
Unfortunately i can't find any pattern to how its pulling the incorrect number.. 
 
The variable displays the 0 in all detail lines..
Could i send you my .rpt file? or would that not help..   I really appreciate your help.. i have been banging my head off the wall for the last week trying to get this last piece to work..


Posted By: DBlank
Date Posted: 07 Feb 2012 at 5:08am
just reread the post.
in the main report try cahnging the display formula to add this red piece...
Whileprintingrecords;
Shared numberVar n;
n:=n;
 
 


Posted By: lowester
Date Posted: 07 Feb 2012 at 5:21am
Just made the change.. it changed the values.. but now it looks once it grabs a value, it does not reset it for the next person.. sorry to be a pain


Posted By: DBlank
Date Posted: 07 Feb 2012 at 5:26am
odd..my test report is not doing that...
create a formula to reset it to 0 and place that in the detail A
move the subreport to detail b
and place the display fomrual in detail c
(unless you haev groupings and yo can use heades and footers instead)
 
Whileprintingrecords;
shared numbervar x;
x:=0


Posted By: lowester
Date Posted: 07 Feb 2012 at 5:38am
from what i can tell.. it looks like that worked!!!!! 

Thank you so much for your help!!.. It is truely appreciated...



Print Page | Close Window