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

Hide Group without any visible subreport

edited December 2003 in Subreports
Hi,

I have a report with a group and within the group there is a subreport.

Depending on the results of the subreport I hide the subreport band using
the visibly:= False.
However I want to hide the group header as well if there is no subreports
visible in the group.

Was thinking of a variable counter in each subreport "OnnCalc" event and
then set the Header band visibilty to false if the "counter" was zero, but
I can't get it to work properly.

Any ideas or is there any built in functionality?

Comments

  • edited December 2003

    Sounds like a timing issue. You need to use the GroupHeader.BeforePrint
    event to set the GroupHeader.Visible property.

    Try creating a summary query that summarizes the counter info for each
    group. Then use this information to set the GroupHeader.Visible property.

    myGroupHeaderVisible := mySummaryPipeline['SumCounter'] > 0;


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2003
    Nard,

    Thanks,
    I got it to work in the Report Builder IDE but when I use exactly the same
    report in my app and load it from the disk I get en error

    "Unable to load BeforePrint code for GroupFooterBand3, no object with this
    name found"
    .
    Another strange thing I've noticed is, if I add the timing on the variable
    to reset on the report header vs have it traversal gives a twice slower
    printout (on the screen) of the report.

    /Ronny

  • edited December 2003

    Are you using Delphi event-handlers or using RB's Calc workspace to code RAP
    event-handler?

    If you implement Delphi event-handlers for the report, then these must be
    published methods of the Form/DataModule that owns the report.

    RAP code is saved as part of the report definition.

    If you have more than one TppReport component on a form/datamodule then you
    may be encountering naming conflicts in which you load a report that
    contains elements with the same name as another report. Thus, the elements
    get renamed upon loading. In Delphi, the component names must be unique
    within a specified Owner.



    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2003
    Nard,

    Thanks, I use using RB's Calc workspace but I had two TppReport component
    on the same form.
    Sometimes when I doubleclick on the TppReport component to make changes or
    preview I end up with a new TppReport component exact on top of the
    original one and it is mission impossible to discover this..

    Why the new TppReport component.

    /Ronny

  • edited December 2003

    I recommend that you use one TppReport component per form/datamodule - this
    will simplify things greatly. And since you are loading templates, it is
    really all that you need.

    Load each report and set TppReport.SaveAsTemplate to False. Do not use this
    property unless you are building an end-user application.


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

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