Page 1 of 1

Variable for dynamic sum

Posted: Mon Oct 11, 2010 3:21 pm
by claveweb
Hi everyone,
I have a table like this

Code: Select all

Product  INVOICE SALES
A               1           3
A               2           2
A               3          -1
A               4           4
B               2           2
B               8           1
I would like to display one row for each sale with a cumulative sum of sales by product

Code: Select all

PRODUCT A 
INVOICE  SALES    SUM 
1               3         3
2               2         5
3              -1         4
4               4         8

PRODUCT B
INVOICE  SALES    SUM 
2               2         2
8               1         3
How can I do that?

I use one variable, in "After Print" event on GroupHeaderBand
variable=0

And in "After Print" event on DataBand component
variable=variable + SALES
but the result (wrong) i get is:

Code: Select all

PRODUCT A 
INVOICE  SALES    SUM 
1               3         3
2               2         2
3              -1         -1
4               4         4

PRODUCT B
INVOICE  SALES    SUM 
2               2         2
8               1         1


Thanks!

Variable for dynamic sum

Posted: Tue Oct 12, 2010 12:53 am
by Alex K.
Hello,

Please see the sample report in attachment.

Thank you.