Print Page | Close Window

total amount per page

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=8000
Printed Date: 01 May 2024 at 9:31pm


Topic: total amount per page
Posted By: cool_a
Subject: total amount per page
Date Posted: 13 Oct 2009 at 2:05am
hi... niubeeee here....
 
i have 5records. n i spread it to 3 pages (each page only have 2 rows)
 
how do i get the total amount of each page?? i dont use group report
 
here is my data:
a   10
b   15
c    20
d   25
e   30
 
i want it to be shown as below:
 
PAGE 1
previous amt: 0
---------------------
a     10
b     15
--------------------
tot   25
 
PAGE 2
previous amt: 25
---------------------
c      20
d     25
---------------------
tot   70
 
PAGE 3
previous amt: 70
---------------------
e     30
---------------------
tot 100
 
how do i get the previous amt???
 
 



Replies:
Posted By: lockwelle
Date Posted: 13 Oct 2009 at 6:20am
the way that I would get the previous amount is to use shared variable in a formula to record it.  you can use it to calculate the total as well.


Posted By: cool_a
Date Posted: 14 Oct 2009 at 1:34am

hi.. thx 4 the reply....

i know it should use the formula... but how??? can u give some sample code? or maybe a step by step.

about the "total", i already able to make it... i only have problem with the previous amount..

thx in advance


Posted By: lockwelle
Date Posted: 14 Oct 2009 at 6:11am
shared numbervar prev;
shared numbervar total;
 
total := total + {table.field};
prev := prev + {table.field};
""//hides the output of the formula
 
to display:
shared numbervar prev
 
HTH


Posted By: cool_a
Date Posted: 14 Oct 2009 at 9:36pm
thx...
 
but it gives a wrong calculation
 
it shows:
 
page 1:  should be: 0, your formulas give: 29.95
a  29.95
b  262.99
------
total: 292.94
 
page 2: should be: 292.94, your formulas give: 305.24
c  275.29
d  35.48
-----
total: 603.71
 
page 3: should be: 603.71, your formulas give: 353.57
e  48.33
f  132.9
--------
total: 784.94
 
i dont use the total formula u've given to me... coz i can manage with the total....
can u give another shot???
 
thx b4


Posted By: cool_a
Date Posted: 14 Oct 2009 at 9:55pm
nvm.... already found
thx a lot 4 your help... coz without your syntax, i am unable to test other formula..


Posted By: narendra_vajral
Date Posted: 16 Oct 2011 at 2:27am
hello,
im also looking for the same
can you post the formula what you using for this?

Thanks
Naren


Posted By: shiloh
Date Posted: 16 Oct 2011 at 10:17pm
Me too,

I looking for the formula which can calculate my balance b/f + amount = cumulative figure.

But my all cumulative is add back the Balance B/f which is wrong.

Example, b/f = 60
A=20   cumulative =80
B=40   cumulative =120
c=60   cumulative =180

can somebody help on this formula how to do?

Thanks


Posted By: lockwelle
Date Posted: 17 Oct 2011 at 11:59am
you need to apply logic to determine when the previous is really 0.  Probably I would use:
if not OnFirstRecord then
 prev := prev + {table.field};
 
 



Print Page | Close Window