Grand Totals Wrong

edited January 2007 in Subreports
I have a Report with on Subreport. The Master Pipeline has a ProdWorkDate
and is joined to the Subreport by same field. I have the date I have one
Group built on ProdWorkDate. In the Detail I have the subreport. One
subreport is generated for each ProdWorkDate. Two records are created for
each ProdWorkDate as First Shift and Second Shift. In the SubReport
Summary I Total the columns. All works well.

On the Main report Summary I have another series of DBcalcs to generate
Grand Totals. What I am seeing is the total of Shift 1 data for all the
dates selected. I have switched from 1 to 2 pass but no different. I do
not reset on anything. I simply get the toals of the first shift.

I am on location. Please help.
10.04 D-2006
Larry

Comments

  • edited January 2007

    - Use TppVariables for the subreport and main report totals.

    - In the Subreport Variable.OnCalc, increment the main report's variable

    procedure VarSubReportOnCalc(Sender: TObject, var Value: Variant);
    begin

    VarSubReport.Value := VarSubReport.Value + {somevalue}
    VarMainReport.Value := VarMainReport.Value + {somevalue}

    end;

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2007
    Why is this necessary. I have a database field and all I want to do is add
    the entire series of them. No filtering, no limiting.
    The sub totals work just fine. It is only the grand totals that are hosed!
    Is this a bug? Why am I only receiving the value for the first variable?


  • edited January 2007

    The DBCalc.Compute method is called by the repot.engine traversal process.
    Each report/childreport has its own report engine. The childreport engine is
    traversing the data that you want to perform the calculations upon. A
    childreport generates in entirety each time it prints on a page.



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2007
    The Grand totals is in the parent report Suimmary detail. But in an effort
    to make it work, I pointed another pipeline to the same data set. I used
    this pipeline for the grand totals on the parent report Suimmary detail.
    Still the same result.

    So I next simply looped through the dataset, computed the totals, assigned
    them to RB labelled components and then issued the print statement. A long
    circuitious route but cleaner then trying to catch the sub-report
    traversing. And I had to get something in fron t of the customer, ASAP


  • edited January 2007

    One alternative approach to relying upon the report traversal process to
    perform the calculations is to use SQL to create a summary query.

    Thanks for the feedback...

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.