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

Reset variable on Group break - page break issue

edited July 2007 in General
Delphi 6, RB 10.06 Enterprise.

I have searched the newsgroups for this already and have found plenty of
similar posts but nothing that solves my issue.

I have group on my report and in the group footer is a ppVariable of type
Integer. It's timings are calculate on Traversal, reset on GroupEnd (Group
0).

The variable is accumulated in the OnCalc event of another ppVariable in the
detail band. Quite simply, there is an if...else condition and if true then
the ppVariable in the group footer is assigned Value := Value + 1;

For each group, the variable successfully resets to zero and accumulates
correctly throughout the group, finally showing the right value in the group
footer. This works great except on a page break. Then, the ppVariable in the
group footer remains at the value it was at the end of the previous page.
The new group on the new page then accumulates starting from that value
instead of zero.

I have had this problem on more than one report and believe there to be an
issue around resetting variables on a new page. I also trie declaring a
global variable in the report and accumulating that during the detail band
variable's OnCalc event, outputting the value to a label or a variable and
then resetting it on the GroupAfterBreak event. Exactly the same thing
happens.

Any ideas or help?

--
Jason Sweby
Software Development Manager,
Carval Computing Limited, Plymouth, UK

Payroll - HR - T&A - Access Control

Comments

  • edited July 2007
    Hi Jason,

    Does this occur when ReportBuilder is executing a TppPageBreak component or
    simply when the page runs out of space just as the group ends. If possible,
    please send a small example that demonstrates this behavior to
    support@digital-metaphors.com in .zip fomat 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
  • edited July 2007
    Thanks for replying Nico.

    It happens when either the page naturally ends or in other reports when a
    group is set to start on a new page.

    The database it is set against at the moment is quite large and an SQL
    Server one, I'll need to try and recreate it using some other dataset or
    maybe a different data source so you're not having to try and restore an SQL
    Server database just to run it.

    Jason.

  • edited July 2007
    Hi Jason,

    If it would be easier, you could try creating an example that demonstrates
    the behavior using the built-in DBDEMOS database that is included with
    Delphi.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2007
    Good idea Nico, I'll give that a go.

    Jason.

  • edited July 2007
    Nico

    I can't recreate the problem using the Paradox DBDemos data, which leads me
    to wonder if the issue could be down to the fact that I'm using SQL Server
    (2000 or 2005) and the ODBCExpress plug-in.

    I wouldn't have expected this to have made any difference because it would
    be the RAP engine that handles the variables calculation, wouldn't it?

    I am sending you the report via email, although you won't be able to run it
    because you won't have my data but could you please take a look at it and
    see if there's something obviously wrong in the RAP please?

    Thank you,
    Jason.

  • edited July 2007
    I've now also created a demo based on the MS Access copy of the DBDemos,
    connecting using ODBCExpress, and the report still works fine. Now wondering
    if it's my query...

    Jason.

  • edited July 2007
    Hi Jason,

    Since this seems to be working with other databases, I would suggest trying
    to recreate the initial report from scratch and see if perhaps you had a
    corrupt template of some sort. Different queries can affect how the timing
    of a variable functions however it does seem interesting that in this case
    it is working correctly for other reports/DB's.

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