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

GroupBreakValue?

edited February 2007 in General
How can I get the current value of the GroupBreak object in a group footer?
The database query row has moved on so I cant read that. It will be the
last value in the detail band but my detail band is invisible.
I'm just wondering if there is a property of the group somewhere that I can
read?

Regards
Paul

Comments

  • edited February 2007
    Replying to myself

    Found tppGroup.BreakValue which is missing from the help.

  • edited February 2007
    Hmmm - looks like I replied to myself too soon.

    BreakValue appears to return the last value pointed to by the query which is
    not the current value the break was based on.
    So values 1,1,1,1,2,2,2 will a return a BreakValue of 2 when the break from
    1 to 2 is detected. When it comes to the end it returns 2 again because the
    query is at eof.

    Is the current value of the break held anywhere? If not I suggest that the
    current BreakValue property is a bug which needs fixing.

    Any other way to get the value I want?

    Regards
    Paul

  • edited February 2007
    Hi Paul,

    I'm a bit unclear about what you are trying to do. If you need the current
    group break value, you can use the TppGroup.OnGetBreakValue event to
    retrieve it. If you need to display this value in the group footer, you can
    store this value until it changes, then update a component inside the group
    footer with the proper break value.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2007
    Hi Nico

    I have a totals only report which uses the same query as the full report.
    It does this by making the detail band invisible in the totals version so
    just the footer totals show. There are two groups and two group footers
    with totals. The inner group has a group value which I need to use to
    change a label caption in the footer.

    If the detail band was visible and printing I could just maintain a local
    variable of the breakvalue every time it printed then use this value in the
    footer.

    I've been using OnGetBreakValue to move the query buffer pointer to the
    previous row (able to do this in IBO without interfering with the query row
    position) and read the value. On the very last record I dont go to the
    prior row, just read the value - unfortunately this bit doesnt work properly
    yet.

    It still doesnt seem right to me that the BreakValue contains the value for
    the next group to be printed instead of the value relevant to the group
    footer. This is also inconsistent when it comes to eof. I could see from
    the source that it is getting the value from the query which isnt very
    helpful since that it wrong and could easily be done in the app code anyway.
    I would have liked the BreakValue to have the value just before the break, I
    think this would be more logical, useful and consistent - although a little
    harder to code;-)

    Regards
    Paul


  • edited February 2007
    Hi Paul,

    Grouping in ReportBuilder was originally designed so that the group footer
    does not generate until the BreakValue changes. This is basically how the
    report engine knows it is time to print the group footer. My suggestion was
    to perhaps keep track of this change on your own using a global variable or
    a class field in Delphi. You can store the current break value as the
    report traverses, then if it changes, you can set the current value to the
    component inside the Group footer band and move on to the next group.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2007
    Hi Nico

    Fixed it.

    I couldnt get your suggestion to work reliably - which may well be my fault.

    Also there is the problem that if a group Header is looking at BreakValue it
    would be logical to see CurrentValue whereas if it is a group Footer looking
    at BreakValue it would be logical to see PriorValue.

    Having discovered that tppGroup.PriorValue is public I have used that in my
    get text procedure for a label in the group footer with perfect results
    :-)))

    Regards
    Paul

This discussion has been closed.