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

sum in each group

edited February 2005 in RAP
hi,
i have a report with 1 group and i must print a partial total in each print
footer:

during the printing of detail band, if the item code is what i need , i sum
the value of the row in a local var i created.
in the gruop footer before print event, i assign the value of the var to a
label , to print it. after this, i reset the var value to zero, to prepare
all to the next group.

Teorically, all ok ...
but now i have a problem : in each page, i see the value of the last group,
not the right value...

i tried with ppLabel or ppVar but in both cases , the report don't "store"
the correct value.
it seems have lookahead alwais checked, but it isn't !!!

i used report.firstpass to make all this calculation only one time, but....
nothing :(:(

any idea/suggestions?
thanks
ciao

Comments

  • edited February 2005

    For RB 9 the TppVariable has been enhanced to better support placing a
    Variable in the Footer band. Particularly when you have a dynamica height
    detail band, there are issues in which the Variable.OnCalc can fire prior to
    determine whether the band will appear on the page.

    Do you have a dynamic height detail band? Do you have Group.KeepTogether set
    to True?

    Normally using a local variable will not work at all, the TppVariable should
    be used. You can increment the TppVariable.Value either in its OnCalc event
    or in another TppVariable's OnCalc event.

    For the special case of a Variable in the Footer band, incrementing the
    Variable.Value in the detailband AfterPrint event sometimes helps. (But with
    RB 9 we tried to make this unnecessary).


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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2005
    i have rb7 ent ;-)

    the event in the detail band is all right: it fires for eash rows and the
    variable value is correctly incremented. (i tested it with some showmessge
    in rap !)
    the problem is to show the value in the footer ... i see alwais the last
    sum of values, not the other :-(

    There's a way with ppDbCalc to sum only some rows ? how i should use onCalc
    ? maybe it can resolve the problem!!!




  • edited February 2005

    If you want to create a simple, minimal example using that demonstrates what
    you are trying to accomplish, we can check it out here. Use only standard
    Delphi components, and the DBDemos data. Send in zip format to
    support@digital-metaphors.com.



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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2005
    done!
    I've resolved by using a ppVariable with calctype = veDataPipelineTraversal
    and in onCalc event I do the sum.

    but sometimes , when the one of the rows to sum is the first new page it
    seems to calc it 2 times ... maybe the db rows is attraversed in the previus
    page too, but it can't print it so re-attraverse it in the next page.
    but i resolved it too with temp var where i mem the last id processed !

    all ok !
    thanks for the disponibility.
    bye


  • edited March 2005

    Try using veTraversal rather than veDataPipelineTranversal

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

    Best regards,

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