Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Tips and Tricks
Message Icon Topic: Addition In Crystal Report Post Reply Post New Topic
Author Message
Ganesh050
Newbie
Newbie
Avatar

Joined: 15 May 2012
Location: India
Online Status: Offline
Posts: 3
Quote Ganesh050 Replybullet Topic: Addition In Crystal Report
    Posted: 27 Sep 2012 at 1:48am
pls i need help regarding crystal report pls help me out asap
i have one column there r some values i want to calculate another column in that display the first row value would be 0 and then start cross addition in crystal report how i show that for that what i do i dont want to calculate running total sum i want to write formula for that which function should i use for calculating addition in crystal report
for example i have following column in crystal report

          Column 1                      Output
              21                               0
              48                             21
              56                             69
               0                             125
               0                             125


i want an output given in Output Column:

I can get the above ans by using running total but i dont want to use running total as i want to write formula based on the result.
Kindly help me with this asap.


Thanx
Ganesh

Edited by Ganesh050 - 27 Sep 2012 at 1:49am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 03 Oct 2012 at 4:39am
shared variables will do the same as running total but you do all the work in formulas. usually in groups of 3, reset, increment, display, start with the easiest:
reset (usually in a group header)
shared numbervar x;
x:=0;
""  // will hide the reset
 
increment (usually in details)
shared numbervar x;
if some condition then
 x := x + {table.field};
"" //again hides the increment from displaying on the report.
 
display (usually in a group footer)
shared numbervar x;
x
 
HTH
IP IP Logged
Ganesh050
Newbie
Newbie
Avatar

Joined: 15 May 2012
Location: India
Online Status: Offline
Posts: 3
Quote Ganesh050 Replybullet Posted: 03 Oct 2012 at 6:40pm
above given formula is not working pls give me another formula for the same output
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 04 Oct 2012 at 4:29am
it's a sample to follow...it is not working since I have no clue as to your data or your logic.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 10 Dec 2012 at 9:34am
Why can't you use a running total?  Is this some sort of class assignment?
An alternative to lockwelle's approach is to do it all in one formula without the separate reset formula.  It would look something like this:
 
NumberVar sumTotal;
 
if PreviousIsNull({table.group_field}) or {table.group_field} <> Previous({table.group_field}) then
 sumTotal := 0
else
 sumTotal := sumTotal + {table.Column1}
 
This sets the value to 0 at the beginning of the report and whenever the group you're adding values for changes.  If you don't have a group, take out the "or {table.group_field} <> Previous({table.group_field}) "
 
-Dell
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.029 seconds.