Show total sum of child databand in master databand

Stimulsoft Reports.NET discussion
Post Reply
ymc
Posts: 31
Joined: Tue Oct 30, 2007 9:00 pm
Location: Hong Kong

Show total sum of child databand in master databand

Post by ymc »

I have a question about how to show the sum up total of the child and show it in the master band.
I have tried to use a variable a and set a += datasoruce.number; in the rendering event.
And put {a} in the master databand Textbox.
However, the manchanism of report engine is run the first databand and then the lower...
That means the value of first child will be printed in the second record of the master databand textbox...and the first value of a will be null or zero and print out.
Sample:

First reocrd:
(Master)
value a = null (print out 0, should be 4)
(Child) (rendering event a += 1+3)
1 + 3

Second record
(Master)
vaule a = 4 (print out 4, should be 6)
(Child) (rendering event a += 2)
2

Third record
(Master)
value a = 6 (print out 6, should be 7)
(Child) (rendering event a += 1)
1

I also tried using SumIf(childband, childband value, condition)..for master-child is ok...but I have some fileds are in
Master1- child1(Master2) - child2 and want to calculate out the child 2 total and put it in Master1 with the above behavior happened.

Any idea?

EDV Gradl
Posts: 228
Joined: Sat Jun 17, 2006 9:50 am
Location: Germany

Show total sum of child databand in master databand

Post by EDV Gradl »

You could use the AfterPrintEvent of the Child band and there set the value of the master textbox.
Post Reply