Home General

Pre-Print test?

edited February 2017 in General
Hi Team,
Before I call ppReport.Print from the program, is there any way I can pre test if something is going to be printed, or
not?

e.g. Passing search period, from/to, to the report, On several occaisions, depending on what the user enters for the
search period, they end up with a blank page in the Prieview because there were no records/data that met the criteria
for the ppReport to print.

If some sort of ppReport.Test could be run before ppReport.Print, and would return a true or false, or the number of
records, or whatever, this could then be used to not attempt the ppReport.Print.

Given the comprehensive nature of RB I'm sure the capability is in there somewhere..

Regards & TIA,
Ian

Comments

  • edited February 2017
    Hi Ian,

    This is what the preview is for :). Using the OnNoData event, you could
    print to screen first, then give your users a message or blank report if
    no data is found.

    It should be possible to print to a generic device (TppDevice) and still
    fire the OnNoData event if no data is found if you want to avoid the
    preview/viewer. Similar to what is done in the first step of the
    following article.

    http://www.digital-metaphors.com/rbWiki/Delphi_Code/Layouts/How_To...Create_a_Spread_Sheet_Style_Report

    If you are taking this route, it would then be much easier and more
    efficient to execute the query yourself using Delphi components and test
    for no data manually.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2017
    Hi Nico,

    Thank you for your reply.
    ATT I always go to the Preview, hence seeing no report. I think this is disconcerting or end users, to see a blank
    page however, as a start, I like the idea of then showing a message that no report data found.

    So, the NoDataBehaviors|ndMessageDialog property works for now.
    Thanks for the pointer.

    Regards,
    Ian


This discussion has been closed.