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

Counting records and multiple pages, report builder 10

edited November 2007 in Subreports
I have a very simple report displaying record information.
One group, one record per line, record count at the end of the group.

I want to display the "line number" en count the records to display it
at the end of the group.

I have in the detail of the group a TppVariable that increments the
total.

I actually have 2 problems, the line numbers (Value of the counting
tpp variable) starts on 2 instead of 1, and counts one "invisible"
record as the pages change.

So I have

group header
Text Label
group detail
TppVariableCounter.OnCalc = increase TppVariableTotal
TppVariableCounter.Value = TppVariableTotal.value
display record info
group footer
display TppVariableTotaal (reset on group start)

And I get

2 - Record 1
3 - Record 2
...
45 - Record 44



47 - Record 45
48 - Record 46

I tried to set the variables to 0 in the group header but it still
starts to "2", and how kan I get it to count normally between pages?

I now use Report builder 10.07, and that report workt fine with
version 9!

Comments

  • edited November 2007
    Hi Chantal,

    Have you tried using a DBCalc component set to Count() rather than a
    TppVariable? Placing one in the detail band will give you the count for
    that particular line and placing one in the group footer should give you the
    group count (set to reset on group end). If you are still having issues,
    please send a small example demonstrating the problem to
    support@digital-metaphors.com in .zip format 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 November 2007
    Using a DBCalc to get the end total always works, but the reason I
    used the variable is to also display the line number next to the
    record.

    I have actually changed the code for this:

    VariableCounter (OnCalc)
    Value := Value + 1;
    VariableTotal.Value := Value;

    instead of

    VariableCounter(OnCalc)
    VariableTotal.value := VariableTotal.value + 1;
    Value := VariableTotal.value;

    And this works...

    I get the totaal, and the line numbers, and no problem while changing
    page.

    I have declared VariableTotal in the Calculation page and associated
    it to a Variable on the main page of my report by "OnCreate" with
    timing calculate passing through and reset on group end.

    I just don't understand why it makes a difference which of the 2
    variables I use to count... I have the feeling the declared
    variableTotal gets updated/resetted more often and at different times
    than the layout variableCounter...and one time too many by page
    change.

    I would gladly send an example but the report builder i'm using is
    embedded in another programma, I don't know if you would be able to
    load an export of the report (report.psfrpt) without the database
    structure...?


    Chantal

    On Mon, 26 Nov 2007 07:21:07 -0700, "Nico Cizik \(Digital Metaphors\)"
  • edited November 2007
    Hi Chantal,

    Check the timing settings of the variables you are using to see when they
    will reset and calculate their value. Also, note that a variable set to
    calculate on traversal located in a subreport will calculate when the
    datapipeline connected to the subreport traverses. This will behave
    differently from any variables in the main report you may have.

    Are you a registered user of ReportBuilder or are you using a product with
    ReportBuilder built-in?

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2007
    I have tried different values of the timing, also without subreports,
    but it rarely does what I expect it to do.

    When I set the timing to "group start", and display the variable at
    each step, I see it being set to 0 after the first record is printed
    instead of before...so I get line 2, line 1, line 2, line 3, ... I
    would expect group start to be "before" doing anything. There is also
    "before group header" and this gives me the same result.

    I also realized that when I use a string variable OnCalc to calculate
    and set values to TppVariable of type float they are not evaluated the
    same way as when I use float variable...

    I used to display the line number as a string " 1 : "
    (IntToStr(variableTotal.value) + ' : ') and use this variable to
    actually increment variableTotal.value at the same time (instead of
    punting it in another variable). When I removed the " : " and made it
    float and just variableCounter.value := variableTotal.value I got
    different (goed) results...

    We are registered users of the ReportBuilder, and integrated it to the
    software our company is building. (and using it in "dutch" so I might
    get property names and timing events wrong when writing in english).

    We have just upgraded to version 10 and many reports from earlier
    version are now giving incorrect totals and must be rewritten.

    The first part of the problem, displaying lines and counting can be
    fixed.

    Our biggest concern now is the second part of the problem which I have
    not yet been able to fix: Reports that "count" records twice by page
    change. As if the builder had to count one record too much to realize
    it's time to change page but the variables are already calculated and
    this doens't get turned back so at the start of the next page all my
    variables have counted a record too much...wich gets recalculated
    one more time on the new page...

    It sometimes works when I set all the groups and subreports to "NOT
    keep together", but then the reports don't look so goed anymore...

    Still working on solving this. If you have any clues...

    Thankx,

    Chantal

    On Tue, 27 Nov 2007 06:52:42 -0700, "Nico Cizik \(Digital Metaphors\)"
  • edited November 2007
    Hi Chantal,

    If possible, please create a small delphi app that demonstrates the behavior
    you are experiencing and send it in .zip format to
    support@digital-metaphors.com. I feel that if I am able to see the problem
    in action, I will be able to find a solution much more quickly.

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