Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Passing shared variables to Main report Post Reply Post New Topic
Author Message
KingTechMary
Newbie
Newbie
Avatar

Joined: 17 Nov 2009
Location: United States
Online Status: Offline
Posts: 1
Quote KingTechMary Replybullet Topic: Passing shared variables to Main report
     Posted: 17 Nov 2009 at 1:10pm
Hello - I have a main report (from orders table) with one subreport (from workflow table).  Both have one grouping on year with counts by year. I want to pass the count from the subreport to the footer of the main report.
 
Using Crystal XI
 
In the subreport I have @Shared Enrollments:
Shared numberVar Enrollments:= Count ({KTI_PFND_Workflow.cmp_code}, {@Fiscal Years});
 
In group header on the main report I have a reset:
Shared numberVar Enrollments := 0;
 
The subreport is in the detail section of the main report
 
In the group footer on the main report I have @Shared Enrollments:
Shared numberVar Enrollments;
 
All I get is zeros. What am I doing wrong? I've also tried removing the reset and putting the subreport in the page header, in which case I get only the last total from the subreport; repeated for each year.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 18 Nov 2009 at 6:31am
everything looks correct.  I am assuming that you have a display in your subreport that shows  Count ({KTI_PFND_Workflow.cmp_code}, {@Fiscal Years}); just to be sure that it is returning a value <> 0 and that the report is not being suppressed.
 
I would try displaying the shared variable in a detail section below the subreport, just to see what values you are getting. I would also display the value of enrollments in the subreport to make sure that it is correct. In short, I would try to 'see' what CR is doing in both the subreport and the main report.  If you have multiple detail lines in the group, you would only see the last Enrollment value, and if that happens to be zero...or if you are suppressing a row in details, the subreport will probably run regardless, and if the suppression is because the enrollment is zero....
 
Hopefully you see where I am going.  Since you only see the results of what CR has done, you need to have CR show you what it is doing.
 
HTH
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