Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

sum of two dbcalc in subreports

edited May 2005 in End User
Hi all,

I need to get a sum of two dbcalc and show it on variable1 (on summary).
One dbcalc is on Subreport2 and another is on subreport3. How can i get it ?
I'm using it on oncalc event of variable1:

value := dbcalc1.value + dcalc2.value;

but its don't works. I'm using lookahead as true.

Thanks all.

Comments

  • edited May 2005
    Hi Sammy,

    When is the TppVariable actually calling its OnCalc event. Check the Timing
    dialog by right clicking on the variable in the designer to find out. You
    need to select the proper time to calculate in order to ensure the DBCalcs
    have already been calculated and are holding the final value.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2005
    My report model:

    Report
    -Subreport1
    -Subreport2
    Report Footer
    Myvariable := Dbcalcvalue from subreport1 + Dbcalcvalue from subreport2


    My variable don't get correct value.




  • edited May 2005
    the time is correct but don't works yet.

  • edited May 2005
    Hi Sammy,

    DBCalc components are not particularily designed to make complicate multi
    report calculations. I sould suggest replacing them all with TppVariables
    in your subreports. Then inside the OnCalc of the TppVariables in the
    subreports, update the value of the variable located in your report footer.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2005
    Now the footerband is not reproduced in execution time.
    I'm using the reportbuilder 9.01 for delphi 7.

  • edited June 2005
    Hi Sammy,

    Sorry, I'm unclear about what is happening in your report. Did you follow
    the instructions I suggested in my previous post? Perhaps a little more
    information on how your report is set up and how you would like it to look
    would help.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2005
    Ok, now i'm usign a group and works fine but i need sum two variables in
    another. See the atachment. The variable3 get the sum of Subreport2 and
    variable4 get sum of Subreport3. There is no problem for it but now i need
    sum the two variables on variable2. How can i do it ? What timing i need to
    use ?

    thanks,
    sammy davis

  • edited June 2005
    Hi Sammy,

    For future reference, please send all attachments to
    support@digital-metaphors.com.

    Inside each subreport, I assume you have another TppVariable in the detail
    band updating the value of Variable3 and Variable4. Why not just simply add
    that value to the total value of Variable2 as well? This way Variable2 will
    be accumulating the total of each subreport as they are generated.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2005
    I'm using tclientdataset. There is problem using it ?
    Without success yet.

  • edited June 2005
    I'm getting strangers results.

  • edited June 2005
    I'm using tclientdataset. There is problem using it ?
    I'm using the datasetfield property from clientdataset to do the
    relationship between tclientdataset's.
    The report work's but i'm getting strangers results. On last record from
    subreport the variable calculate two times.
    Without success yet.


  • edited June 2005
    Hi Sammy,

    If possible, please send a small example demonstrating this behavior that I
    can easily run on my machine to support@digital-metaphors.com in .zip format
    and I'll take a look at it for you.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.