Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: How to sum a formula in a group? Post Reply Post New Topic
Author Message
martz
Newbie
Newbie


Joined: 03 Apr 2009
Location: Netherlands
Online Status: Offline
Posts: 1
Quote martz Replybullet Topic: How to sum a formula in a group?
     Posted: 03 Apr 2009 at 3:09am
Hello,
Column1             Column2             Column3
Details: “Budget”             “Costs”                “Result”
GF2        Sum(budget)    Sum(costs)         Formula(GF2)
GF1        Tot.sum(budg) Tot.sum(costs) Sum(Formula(GF2))
 
I can’t figure out how I can calculate the Sum(Formula(GF2)) since this is not a result of the detailed section but a calculation of group results: Formula(GF2) depends on the type of GF2…
 
I have tried using variables, but I didn’t work for me…
 
Any input on how to solve this is really welcome!!!
 
Thanks in advance!


Edited by martz - 03 Apr 2009 at 3:11am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 Apr 2009 at 6:29am
In Formula for GF2, add a line at the top:
shared numbervar sumGF2;
local numbervar GF2;
 
set GF2 = to your original formula value then to update the summary
sumGF2 := sumGF2 + GF2;
GF2  //Crystal prints the last value that it 'sees'
 
Create a new formula, say, summaryGF2 and all that it would contain is:
shared numbervar sumGF2
 
create a new formula, I usually call Reset
shared numbervar sumGF2 := 0
""  //I suppress the out put so the user can't see it.
 
reset would go probably in GF1 header, so every time it changed, the summary would start over,  the summaryGF2 would go in the GF1 footer where you want the summary to be displayed.
 
Hope this helped
 
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