Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Sum the amount fetched from 3 subreport Post Reply Post New Topic
Author Message
catch_meow
Newbie
Newbie
Avatar

Joined: 26 Jan 2009
Location: Philippines
Online Status: Offline
Posts: 4
Quote catch_meow Replybullet Topic: Sum the amount fetched from 3 subreport
     Posted: 27 Jan 2009 at 4:19am
Hi, hoping someone could help me with this problem.. its really urgent that i learn how to do this. anyway, here it goes...
I have 1 main report and 3 subreport (in 3 diff.detail row). I used a Shared Variable to get the total Amt of these 3 subreports. But whenever, I sum up the 3 amounts in the main report I could not get the right answer.
Ex.
Group-Name header: Name1
detail a:    subreport 1     total 300
detail b:    subreport 2     total 400
detail c:     subreport 3     total 100
Group-Name footer:         800
 
Group-Name Header: Name 2
detail a:   subreport 1     <no value>
detail b:   subreport 2     <no value>
detail c:    subreport 3     <no value>
Group-Name Footer:       800  -- this is my problem.  my formula for this is
                                                   (sub1+sub2+sub3) --refers to shared var
 
Please help!!!
thanks
 
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 27 Jan 2009 at 6:42am
looks like in group header name, you should have a formula that sets you your shared values to 0...it looks like the values in your shared variables are retaining their prior values (like you want them to).
IP IP Logged
catch_meow
Newbie
Newbie
Avatar

Joined: 26 Jan 2009
Location: Philippines
Online Status: Offline
Posts: 4
Quote catch_meow Replybullet Posted: 27 Jan 2009 at 7:18pm
Hi, i've tried this formula in the main report
WhilePrintingRecords;
Shared Numbervar ap_curvar:= 0;
 
and in the subreport
whilePrintingRecords;
Shared Numbervar ap_curvar:=ap_curvar + (sum({@apvar}))
 
@apvar --pertains to the data field
 
still.. the result is the same.. i even tried to use Total formula first in the subreport and point it to the main report.. same result :(.. and the last thing i did was I tried to put declare the "ap_curvar" in the group selection formula.. but i get the error that this variable will be evaluated later. this means that i cannot use this variable since i used it as shared var in a whileprintingrecords evaluation time of the crystal report.
 
Pls.. help :D
Thanks,
cathy
IP IP Logged
catch_meow
Newbie
Newbie
Avatar

Joined: 26 Jan 2009
Location: Philippines
Online Status: Offline
Posts: 4
Quote catch_meow Replybullet Posted: 28 Jan 2009 at 1:45am

I've already resolve this problem, thanks for the tips.. however, will u help me how to make a grandtotal out of these shared variables. I cant use RUNNING TOTAL. the field with formula of shared variable do not reflect. please advise

thanks again
-cat
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 28 Jan 2009 at 6:32am
to make a grand total, all that I do is have another shared variable running, and at the group footer, before you reset the variable to 0, I update the grand total variable.
 
OR you can have the grand total variable and just increment it every time you increment the other variable, just don't reset it to 0
 
Hope this helps
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