Page Subtotal
I want to calculate a page subtotal of a column, At first I try to use a
variable (e.g. subtotal) and sum the variable at the aftergenerate event of
detail band. (subtotal := subtotal + field.value). By I find that if there
are more than one page, then sometimes the aftergenerate will execute one
more than expected (e.g. if there are 23 rows in the detail band of the
first page, the detailband.aftergenerate will execute 24 times), so the page
subtotal calculated is wrong.
So, Is there any suggestion to calculate page subtotal of a column in a
detail band and display the page subtotal in page footer band?
variable (e.g. subtotal) and sum the variable at the aftergenerate event of
detail band. (subtotal := subtotal + field.value). By I find that if there
are more than one page, then sometimes the aftergenerate will execute one
more than expected (e.g. if there are 23 rows in the detail band of the
first page, the detailband.aftergenerate will execute 24 times), so the page
subtotal calculated is wrong.
So, Is there any suggestion to calculate page subtotal of a column in a
detail band and display the page subtotal in page footer band?
This discussion has been closed.
Comments
If you are calculating a sum in the page footer and using a dynamic height
detail band, you are probably seeing a limitation of ReportBuilder. The
only way to work around this issue is to make the calculation for the sum in
the detailband.afterprint event. Note that this event may fire more than
once per record so you will need to add some logic to account for that
possibility.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
for a record and when it will not? Is there no methods to calculate page
totals?
Sorry, I mis-read your first post. Before trying to solve the issue with
the DetailBand.AfterGenerate, try making all calculations related to your
total variable in the OnCalc event of another variable inside the detail
band. Simply place an invisible TppVariable inside the detail band and in
its OnCalc event update the variable in the footer band. If you still have
an issue after doing this, you can try making the calculation in the
DetailBand.AfterPrint with logic that checks the current record every time
the event if fired. This way if the record is the same twice, the code
inside the event will not get fired.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com