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

Calcaluate group total in group footer

edited March 2005 in General
Suppose the report has two group (group 0 and group 1) and in the detail
band, there are some dbtext for display the record in master Table and a
subreport for display the detail table, then I need to display the sum of a
field in the detail table at the group 1 (outer group) footer band , how to
do that?
if the sum is display in the subreport, I think using dbcalc is ok, but how
about to show the sum in outer group footer in main report (the detail
record is placed in subreport, not in main report).

Comments

  • edited March 2005
    Hi Kei,

    If you are using RAP see the following example of keeping a running total.

    http://www.digital-metaphors.com/tips/mdraprunningtotal.zip

    It also helps us if you post all RAP questions in the RAP newsgroups.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2005
    How to solve if not using RAP?


  • edited March 2005
    For your example, you use the oncalc event of tppvariable to calculate
    running total, but what will happen if user jumping page from page 1 to 3
    without seeing page2? (the value in page 2 will also be calculated? expected
    result is yes)


  • edited March 2005
    I have seen your example but I don't understand why there is value in
    vblMain?
    There is no any OnCalc event for vblMainTotal, where is the value come from?

  • edited March 2005
    In the Global oncreate event, there is a statement
    MainTotal := vblMainTotal;
    What is it's function?
    I still don't know where is the value of vblmaintotal come from?
    I found that I have no method to change the value of global variable in
    oncalc event of Tppvariable in subreport, I can't say why? I have waste one
    day for study this simple task, any easier method or example given to me and
    any good reference?
    (I have wrongly create a new post , not reply, in this group, sorry about
    that!)

  • edited March 2005
    Hi Kei,

    I'm sorry, I assumed you were using RAP. If you are not using RAP, simply
    place a TppVariable inside your detail band and inside its OnCalc event
    update the value of another TppVariable located somewhere else on your
    report.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2005
    Hi Kei,

    In the Calc tab, if you view the RAP code for the subreport (use the tabs at
    the bottom), you will see that in the OnCalc event of the DetailValue
    variable uses the global variable gMainTotal to update the values of the
    variables in the main report.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2005
    This code is to set up a reference between the vblMainTotal variable and the
    global variable gMainTotal. This is necessary in order to access objects
    from a subreport in RAP.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2005
    1) If not using RAP, your method means place a TppVariable inside the detail
    band of SUBREPORT and in its OnCalc event update the value of another
    TppVariable located in the main report group footer?
    2) If this is true, then if the user jumping page (from page 1 jump to page
    3 without preview page 2), then will the result not included value in page
    2?
    3) Also, Assume the tppvariable is inside a region of detail band in
    subreport, then will the oncalc event fires more than once if the detail
    band in subreport cannot fit in the page and then print on another page ?
    (So the group total in main report is larger than the correct, expected
    value)?

This discussion has been closed.