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

NoData

edited June 2017 in General
Hi,

I have report (with Header, Footer, Group(s), Detail band, ...)
connected to a Dataset. Is it possible, when there are no data, to only
print Header and Footer ?

Thank you

--
Arnaud

Site : http://www.mesnews.net

Comments

  • edited June 2017
    Hi Arnaud,

    If you set the Report.NoDataBehaviors to ndBlankReport, all
    non-data-aware components will display as normal in a no-data scenario.

    See the TppCustomReport.NoDataBehaviors topic in the RB help for more
    information.

    Then you could use the OnNoData event to hide anything else you do not
    want showing up in this situation (Detail band components, Groups, etc.).

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2017
    Nico Cizik (Digital Metaphors) à écrit dans le forum
    "digital-metaphors.public.reportbuilder.general" :




    Ok, I try but don't work :-(

    I modify sample 111 in directory Demos\1. Reports :
    - unit dm0111, I set ppReport1.NoDataBehaviors = ndBlankReport
    - tblBioLife : I put "Length_In=-1" in Filter, and set Filtered=true

    => now, if I preview report, I have a report with a yellow "Header
    Band", blue "Detail band" and magenta "Footer band".

    I want to hide Detail and Footer, so on OnNoData event in Calc, I write
    :
    Detail.Visible := false;
    Footer.Visible := false;

    If I preview, I always have the Detail and Footer band. What is the
    problem ?

    --
    Arnaud

    Site : http://www.mesnews.net
  • edited June 2017
    Hi Arnaud,

    Yes, it appears the OnNoData fires too late to actually alter the report
    output. Try checking for and empty dataset in the BeforePrint event
    instead.

    procedure TForm1.ppReport1BeforePrint(Sender: TObject);
    begin
    if (ppReport1.DataPipeline.BOF and ppReport1.DataPipeline.EOF) then
    begin
    ppDetailBand1.Visible := False;
    ppFooterBand1.Visible := False;
    end;

    end;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2017
    Nico Cizik (Digital Metaphors) a exposé le 16/06/2017 :




    OK thank you, it's ok with this methode.

    --
    Arnaud

    Site : http://www.mesnews.net
This discussion has been closed.