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

NoData Event...

edited September 2001 in General
I like to hide the detail band completly when the report does not contain
any data. Unfortunatly the row is being printed before the event is
triggered. Can I somehow detect if there is data in the "BeforePrint" event
or manage to do this in another way?

-------------------------------------------------------------------
Marco Heine
QUMAS
Enterprise Compliance Management
Visit our Website: www.qumas.com

Comments

  • edited September 2001
    Configure the NoDataBehaviors property of the report to BlankPage.

    If you want to check for records in the BeforePrint event of the detail band
    then you can do this:

    procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
    begin
    if ppReport1.Datapipeline.EOF then
    ppDetailband1.Visible := False
    else
    ppDetailband1.Visible := True;
    end;



    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited September 2001
    And you'll want to also check to make sure that the RecordNo property of the
    data pipeline is equal to zero.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited September 2001
    Hi Jim,

    I solved that problem a bit before you posted your solution. However,
    slightly different. Your solution does not work as the datapipeline does not
    contain any meaningful data during the "BeforePrint" event (trying to
    opening this pipeline causes an error that there is no query to be executed
    in my DADE plugin). What I do now instead is, I assign the OnStartPage event
    just before I do the print, determine there if the detail band should be
    visible (using the same method you have suggested in your solution) and
    unassign the event handler by setting it to nil.

    Seems to work fine :)

    -------------------------------------------------------------------
    Marco Heine
    QUMAS
    Enterprise Compliance Management
    Visit our Website: www.qumas.com

This discussion has been closed.