Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Pass shared Variable to Main report thru subreport Post Reply Post New Topic
Author Message
chudok
Groupie
Groupie


Joined: 18 May 2010
Online Status: Offline
Posts: 70
Quote chudok Replybullet Topic: Pass shared Variable to Main report thru subreport
    Posted: 30 Mar 2016 at 1:52am
I am having issues with passing subreport data to my main report in a Group Footer.

I can get the data to show but i keep getting a zero dollar pass through in the first group footer. So this makes all my totals off by a group

Example:
GF1
Branch 5 should have 1484.77 but shows 0
Branch 15 should be 4317.00 but shows 1484.77
Branch 22 should be 6011.11 but shows 4317.00

I cannot figure out why the 0 shows up.

I have both groups exactly the same in both main and subreport

subreport code is
whileprintingrecords;
Shared NumberVar INV:= Sum ({@TOTAL}, {@BRANCH})/21

main code is
whileprintingrecords;
shared numbervar INV;
INV;

I have them linked on @branch.

IP IP Logged
Valert16
Groupie
Groupie
Avatar

Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
Quote Valert16 Replybullet Posted: 30 Mar 2016 at 4:36am
The results you show seem to belong to the previous branch, not to the current one.
That suggests that you are calling the subreport before a branch has reached the expected value. May be? From which section are you calling the subreport?
IP IP Logged
chudok
Groupie
Groupie


Joined: 18 May 2010
Online Status: Offline
Posts: 70
Quote chudok Replybullet Posted: 30 Mar 2016 at 7:15am
I found out my issue was because I needed to drop my subreport into a group above my formula. this worked and everything now lines up. But of course this causes issues on my export to excel (data only).
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 31 Mar 2016 at 6:27am
Lots of luck getting everything to line up using a sub-report.  Not impossible, but can be challenging
IP IP Logged
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.016 seconds.