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

Identifying the last line in a group

edited August 2003 in General
Hi,

I have a group and i'd like to display its subtotal on the right of the last
line in the group. Maybe an example:

Group #1:
---------
G_ID Value Total
1 10
1 4
1 5 19

Group #2:
---------
G_ID Value Total
2 10
2 1
2 5 16

.
.
.


As you can see the value of Total ( which is a TppDBCalc component ) is
displayed only when the last line in the group is displayed. The problem is
that i don't know how to show and hide the DBCalc variable so that it would
be displayed as in the example. I tried to control its visibility in the
BeforeGroupBreak and AfterGroupBreak events but unsuccessfully (i can't
display it only on the last line of each group).
Btw, the Total should be displayed in the same line as the last record
printed in the group and not a line below (this problem could probbably be
solved by creating a new group).

Thanx for any suggestions

Comments

  • edited August 2003
    Hi jure,

    You can solve this problem by calculating the value of the total below the
    group then placing a new Draw Command in the position of the last line of
    the group. In the example below, the totals are calculated in ppVariable1
    in the group footer band, then the value is displayed in a new draw command
    in the correct position.

    http://www.digital-metaphors.com/tips/DrawInDetail.zip

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2003

    command

    Hi,

    it works. Thanx very much!

    May i ask where is it possible to get a more detailed help or even some
    tutorials on programming in RB? In the PDFs that are on the
    digital-metaphors site i haven't found much explanation on how to program in
    RB. I'm asking that because i copied the source code from the example you
    suggested, but i don't even understand it completely - or better i suspect
    what it does. For example the "FCurrentPosition" is probbably the top
    position of the last "thing" that was printed in the report.... Another
    function that isn't explained in the help is ppToMMThousandths (probbably it
    converts from on type of units to millimeters).
    (BTW, i use ReportBuilder 6.03 and Delphi 5.0)

    Thanx again
  • edited August 2003
    Hi,

    Glad that worked for you :). Most of the methods used in this example were
    class functions from the ppUtils.pas file. These are undocumented class
    functions and procedures used to help with the report generation and
    printing process. For example, all reports and report objects are measured
    in microns behind the scenes to ensure the most accuracy when printed to a
    printer. The ppToMMThousands function converts a measurment of a given unit
    type to thousandths of millimeters (or microns). There are many other
    useful routines in the ppUtils.pas file that you are also welome to use.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.