Home Subreports

Adding subreports totals

edited December 2002 in Subreports
Hi there, and merry christmas....
The situation:
- A report with a group.
- The detail band contains two subreports.
- Each subreport has a Summary with a Sum dbCalc over a column.

what i want: In the Group footer of the main record i want to have the
difference between the two dbCalcs of the subreports.

I tried with a Calc component but the first group of data doesn't show
any result, the second group shows the result of the first group, the
third shows the result of the second and so on... what should i do?
Thanks for the answer and thanks for another year of great support and
great products.

--
Guillermo Castaño Acevedo
Gerente de Sistemas - Grupo Millennium Ltda
GuillermoC@GrupoMillennium.com
http://www.GrupoMillennium.com

Comments

  • edited December 2002
    Happy Hollidays,

    Subreports are full reports embedded in a report. So, when they finish
    printing, they reset. When this happens, all the variables and calcs in them
    are reset. So, you'll have to get hte values out of them before the
    subreport ends.

    First you could try using the AfterGenerate of the two summary bands to save
    the value of each DBCalc into two TppVariables (or use a TList of
    TObject(YourTotalIntegers)) in the main group footer. Then use another
    variable in the group footer with its OnCalc event assigned, to calculate
    the difference between the two values.

    If that doesn't work, then try using TppVariables exclusively and their
    OnCalcs. Use them in the summary band instead of the AfterGenerate event for
    the timing. Also, use a TppVariable instead of the DBCalc in order to
    control the timing (CalcOrder property) in the summary band so that the one
    variable can calculate the total before the other variable updates the total
    values. Or you could use one OnCalc to perform the total and update the two
    values in the main report variables or TList.

    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited December 2002
    Cool, piece of cake ;)
    Thanks again

This discussion has been closed.