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

Running SubTotals

edited August 2001 in General
Hi,

I am unsure how to calculate a value that needs to be displayed on my
report. My report's detail band (hooked up to PipelineAccounts) has a
subreport (hooked up to PipelineActivity). The subreport has groups based on
a month field. My group footer sums all activity in that month and shows it
in a NetChange TppDBCalc component. All this works fine. However, my report
needs to show a monthly running total for each account. I have a TppVariable
called EndingBalance for this. PipelineAccounts has a starting balance
field. If it's the first month in PipelineActivity, I need to add
StartingBalance to the NetChange to get EndingBalance; all other months need
to add the previous month's EndingBalance to NetChange to get the new
EndingBalance. Can this be accomplished? How?

Natalie

Comments

  • edited August 2001
    You have a group on month. But in the first group, you would like to
    calculate the ending balance using the month's net change plus the starting
    balance. For all the other months, you need to add the previous month's
    ending balance to the net change.

    What you can do is use a boolean flag variable that tells you if you are on
    the first group or not. The IsFirstGroupVariable can be set to true in the
    Report.BeforePrint event. Use the Group.AfterGroupBreak event to set it to
    false. Then in the OnCalc of the EndingBalance variable, use this flag to
    determine how to calculate its value.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited August 2001
    Hi Jim,

    Thanks for the response. Please see below.

    starting

    Exactly.

    on
    to

    I tried this, and put the following code in my OnCalc event:
    if FbFirstGroup then
    Value := rdcalNetChange.Value + PipelineAccounts['START_BALANCE']
    else
    Value := Value + rdcalNetChange.Value

    PipelineAccounts is the pipeline for the main report. Everything seems right
    except that first group's value. It seems as if the BeforePrint event of the
    report may not be the right place to set FbFirstGroup... the groups are in
    my sub-report, not the main report. I tried to set FbFirstGroup = True in
    the subreport OnPrint event, but that broke when going from one page to the
    next. Any advice?

    Natalie
  • edited August 2001
    There is a titleband of the subreport you can resize to zero height and use
    its BeforePrint event. That should fire once at the start of each
    subreport.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited August 2001
    Works great, Jim. Thanks.
    Natalie

This discussion has been closed.