Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Passing total value from subreport to main report Post Reply Post New Topic
Author Message
me_kenny
Newbie
Newbie


Joined: 04 Dec 2009
Location: Malaysia
Online Status: Offline
Posts: 4
Quote me_kenny Replybullet Topic: Passing total value from subreport to main report
     Posted: 04 Dec 2009 at 5:36am
hello there,

i have a main report with a subreport. the subreport is placed in the details section.

the problem is, when i called the running total from the subreprt to the main, it doesnt total up but instead show the last figure from the subreport.

here is an example;

Invoice number   Description    Amount
inv001                 paper A             2
inv001                 replacement      1 <-----From subreport
inv002                 paper B             3
inv003                 paper C             4
inv003                 replacement      2 <-----From subreport

                            Total                 6 <----- this shud be the correct one but mine came out 7.

The subreport links the invoice number with the main report. I calculate the total by having the running total of the main report minus the subreport. Apparently the figures came out correctly during preview but not the total. it seems that the running total from my subreport is only 2 instead of 3.

Anyone has a solution to this problem? I'm sorry for the long story as i try my best to explain. Your help would be much appreciated. thank you in advance
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 07 Dec 2009 at 6:18am
how are you passing the values from the subreport to the main report?  The only way that I am aware of is to use shared variables. If you are already using the shared variables, the next question is if the subreport is being called before the use of the variable...it might be lagging.
 
HTH
IP IP Logged
me_kenny
Newbie
Newbie


Joined: 04 Dec 2009
Location: Malaysia
Online Status: Offline
Posts: 4
Quote me_kenny Replybullet Posted: 07 Dec 2009 at 9:17pm
hey,

thanks for replying. yeap, i used shared variable and i don't get the part "if the subreport is being called before the use of the variable". Mind explaining me more about that part? perhaps  that could be the problem


Edited by me_kenny - 07 Dec 2009 at 9:19pm
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 08 Dec 2009 at 6:08am
say your subreport returns it variable after CR has 'used' it. Since I don't know when CR is creating the subreport vs using the shared variable, it could be that the results of the subreport are lagging the use.  Another easier example, the results of the shared variable are used in a group header, but the subreport is used in the details section or the footer section.  This second example is more obvious, but sometimes I think this is what happens in other less obvious cases.
HTH
IP IP Logged
me_kenny
Newbie
Newbie


Joined: 04 Dec 2009
Location: Malaysia
Online Status: Offline
Posts: 4
Quote me_kenny Replybullet Posted: 08 Dec 2009 at 4:32pm
yea, i get the picture. .i shall try it out and let u knw how it goes. .hopefully this works. .
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