Home Subreports

Subreport totals on summary band on main report error

edited February 2017 in Subreports
Hi
I'm using RB 17.03. I have a master detail report. Main report contains
master datasource and the subreport contains detail datasource. The
subreport has a summary band with a total and so on with every master
record.
I need to show a summary band in the main report with the total adding
of every subtotal, on the summary band of the subreport.
I put a DBCalc variable in the summary band of the subreport with the
total of a record field and on the OnCalc event of this variable, I set
the value of a global variable (for example gTotal := DBCalc1.Value).
Then in the summary band of the main report I have a variable of type
Double and on its OnCalc event I add to its value the gTotal value
(myGrandTotal.Value := myGrandTotal.Value + gTotal).
It works fine except that the last total value in the subreport, is not
contained on this grand total but if after previewing it, I print to PDF
for example, then it calculates correctly and the last subtotal value is
included on the grand total. If the whole report needs only one page it
works ok but if the whole report needs more than one page I have the
problem mentioned
How do I solve this issue? I show an example of the problem. I hope it's
understandable


Main record 1
subreport record value 1
subreport record value 2
subreport record value 3
-------------------------
Subreport summary total (1 + 2 + 3) = A

Main record 2
subreport record value 1
subreport record value 2
subreport record value 3
-------------------------
Subreprot summary total (1 + 2 + 3) = B

Main record 3
subreport record value 1
subreport record value 2
subreport record value 3
-------------------------
Subreprot summary total (1 + 2 + 3) = C

Previewing shows grand Total main report only adding A + B. Then if I
print to PDF or Excel Grand Total adds A + B + C

Thanks



---
El software de antivirus Avast ha analizado este correo electr?nico en busca de virus.
https://www.avast.com/antivirus

Comments

This discussion has been closed.