Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: shared Variable help? Post Reply Post New Topic
Page  of 2 Next >>
Author Message
lowester
Newbie
Newbie


Joined: 30 Sep 2011
Online Status: Offline
Posts: 23
Quote lowester Replybullet Topic: shared Variable help?
    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
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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


Edited by DBlank - 06 Feb 2012 at 8:45am
IP IP Logged
lowester
Newbie
Newbie


Joined: 30 Sep 2011
Online Status: Offline
Posts: 23
Quote lowester Replybullet 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!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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)?

IP IP Logged
lowester
Newbie
Newbie


Joined: 30 Sep 2011
Online Status: Offline
Posts: 23
Quote lowester Replybullet 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..

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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. 


Edited by DBlank - 07 Feb 2012 at 4:01am
IP IP Logged
lowester
Newbie
Newbie


Joined: 30 Sep 2011
Online Status: Offline
Posts: 23
Quote lowester Replybullet 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..

Edited by lowester - 07 Feb 2012 at 5:02am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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;
 
 
IP IP Logged
lowester
Newbie
Newbie


Joined: 30 Sep 2011
Online Status: Offline
Posts: 23
Quote lowester Replybullet 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
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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


Edited by DBlank - 07 Feb 2012 at 5:27am
IP IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
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



This page was generated in 0.032 seconds.