Home Subreports

Problem getting correct total

edited February 2008 in Subreports
I have a report which contains a subreport that shows some different usages
for every day. On the main report page I have a couple of totals.
Basically on the sub report in the summary band I have a TppVariable
component and on the OnCalc event I have set the values of the TppVariable
components on the main page. Very similar to what you guys show in a lot of
your messages on getting totals to appear on the main report page. This
seems to work on all of my reports except one. I have been over sever
setting and the code and can not seem to find the problem. Basically my
totals on the main page are off by exactly the amount of the first line on
my detail band on my sub report for example my report would print out like
so


1 5 10 0 <- detail band output.
2 5 10 100
3 5 10 100
6 15 30 200 <------ sub total printed in summary band
of sub report
7 20 40 200 <------ sub total from main report page
notice all columns are off by the amount of the first detail band



Any ideas? Is there a setting someplace that on this report I either set or
didn't set? Any help would be great I'm at a complete loss here.

Thanks in advance,
Rodger Van Kirk

Comments

  • edited February 2008
    Hi Rodger,

    Which version of ReportBuilder are you using? How does this report differ
    from the reports that function correctly?

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2008
    I'm using D2007 and RB 10.07

    The second question is kind of where I'm baffled. As far as this part goes
    its identical to all the other reports. The other report are just different
    views of the same information. But the Total and group totals and grand
    totals it is identical.

    The Totals work properly.

    The Group totals and Grand totals are the ones that are off.

    The TppVariables are calculated in the Detail band where the Totals are
    calculated. The Totals are TppDBCalcs that use a dcSum CalcType. The on
    calc code for the TppVariable is as follows.

    varSiteIrrigationUsageTotal.Value := varSiteIrrigationUsageTotal.Value +
    pplDaily[ppDBCalc8.DataField];
    varGrandTotalIrrigationUsage.Value := varGrandTotalIrrigationUsage.Value +
    pplDaily[ppDBCalc8.DataField];

    Thanks in advance,
    Rodger Van Kirk



  • edited February 2008
    I Moved my TppVariable.OnCalc code to the OnCalc of the TppDbCalc for the
    Total and now the Site totals and Grand totals are correct. Is there
    anything wrong with doing it this way and just eliminating the TppVariables
    and putting all my OnCalc codes under the total TppDbCalc.OnCalc events?


    Thanks in advance,
    Rodger Van Kirk


  • edited February 2008
    Hi Rodger,

    There should be nothing wrong with calculating this way however it is a bit
    concerning that the OnCalc for the TppVariables is not functioning
    correctly. When you were using variables, what datatype did you have them
    set to (i.e. String, Integer, Double, etc.)?

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2008
    The CalcType is set to Traversal and the DataType is set to String

    That must be it cause my other reports are set to Double or Single (the ones
    that work). I know this report used to work so it must have changed during
    one of the old upgrades. I think I've been using RB since before 7.0

    Thanks,
    Rodger Van Kirk





  • edited February 2008
    Hi,

    Just to let you know, I've had the same problem with all my customers
    report between version 7 and 10 of the report builder.
    When the variables used to update totals are string, it doesn't work
    anymore. But when I changed them all to double, everything worked.

    Chantal

    On Mon, 11 Feb 2008 14:28:21 -0800, "Rodger Van Kirk"
  • edited February 2008
    Yes, it is now necessary to set the DataType of any numerical (calculating)
    variables to something other than String. String variables are timed
    differently to handle String specific cases (truncation, caching, etc.).

    --
    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.