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

Message on report while no data is found

edited April 2003 in End User
Hi,

I have generated a report that prints a daily report from a server to the
printer.

I want to print the report even when there is no data. I want to print a
message on paper that there was no data. Just a label or something.

With the standard settings it will print a empty page.

How can I do this?

I am using ReportBuilder 7.01 Enterprise with Delphi 5.0

Thanks in advance and best regards,


Mischa E. J. Hoogendoorn

Comments

  • edited April 2003
    Use the NoDataBehaviors property on the report in conjunction with the
    OnNoData event. See the help topic for more info.


    uses
    ppDrwCmd;

    procedure TForm1.ppReport1NoData(Sender, aDialog: TObject;
    var aShowDialog: Boolean; aDrawCommand: TObject;
    var aAddDrawCommand: Boolean);
    begin

    TppDrawText(aDrawCommand).Text := 'No Data';

    aAddDrawCommand := True;

    end;



    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited April 2003
    Jim ,
    I have a similar problem with a one-page subreport that occasionally has no
    data. I would like to eliminate the printing of this page or at least print
    a "No Data" message. I have tried the code suggested here but I always get a
    blank page regardless of the code in the NoData procedure. How do you handle
    this via the end-user reporting environment? I suspect that I need to set
    NoDataBehaviors but do not know how to do this in the end-user reporting
    tool.

    I have a similar problem with a one-page subreport that occasionally has no
    data. I would like to eliminate the printing of this page or at least print
    a "No Data" message. I have tried the code suggested here but I always get a
    blank page regardless of the code in the NoData procedure. How do you handle
    this via the end-user reporting environment? I suspect that I need to set
    NoDataBehaviors but do not know how to do this in the end-user reporting
    tool. Note I am still using Delphi 5 with RB 6.0.



  • edited April 2003
    As an end user, you can't set the no data behaviors if you don't have RAP.
    You'll have to create a RAP pass through function(s) to set the
    NoDataBehaviors[] set property, as sets aren't supported in RAP. There are
    examples of creating RAP pass through functions in the RAP demos and in the
    RAP help file.

    Outside of the end user environment, if you don't want to preview a page at
    all, then you'll have to check to see if you have data before calling
    Report.Print. Then selectively call Report.Print or show a message box.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.