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

No Data Behaviour

edited April 2005 in General
When I my report has no data some of the objects are still visible (charts
etc). I want a totally blank screen with my message only.

Here is my code.

ppReport1.OnNoData := ppReport1NoData;
ppReport1.NoDataBehaviors := [ndMessageOnPage, ndBlankReport];


procedure TIN_RBVIEWER.ppReport1NoData(Sender, aDialog: TObject;
var aShowDialog: Boolean; aDrawCommand: TObject;
var aAddDrawCommand: Boolean);
var lDrawText : TppDrawText ;
i : Integer;
rpt : TppReport;
begin
aShowDialog := FALSE;
if (Sender is TppReport) then
begin
rpt := (Sender as TppReport);
for i := 0 to Pred(rpt.BandCount) do
rpt.Bands[i].Visible := FALSE;
end;
lDrawText := aDrawCommand as TppDrawText;
lDrawText.TextAlignment := taCentered;
lDrawText.Text := 'Nothing';
lDrawText.Left := 0;
lDrawText.Width := ppReport1.PrinterSetup.PageDef.mmPrintableWidth;
end;

Comments

  • edited April 2005
    Hi,

    ReportBuilder does not natively support the ndBlankPage, ndMessageOnPage
    combination (i.e. completely blank report with a message on the page)
    because when the ndBlankPage option is selected, a page isn't even sent to
    the device. If you need this type of behavior, you can:

    a. Use the ndBlankPage, ndMessageDialog combo.

    b. Check your dataset before your report generates and if it has no records,
    loop through each object in your report and temporarily set the Visible
    property to False. There is an article in the Tech-Tips newsgroups under
    the CodeBased thread on how to loop through all the objects in a report.

    --
    Regards,

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

    Best Regards,

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