onBeforePrint

Good day,

I am having an issue with onBeforePrint and OnGetValue events not firing during PrepareReport
when application is run on target computer.

Everything works fine on my development system. It's just that on a target system, the report is
blank. I've verified that the report template (fr3) file is present and no errors are generated. At this
point, I'm just looking for an indication of where to look and how to debug this.

I didn't think there were any FastReport files required when an application is distributed but perhaps
I'm wrong.

I'm using FastReport VCL 5 Enterprise with Delphi Berlin and Windows 10.

Any and all pointers welcome. Thanks!

Comments

  • PolomintPolomint Australia
    edited 6:26AM
    Differences in the report source data on the two systems?
  • edited 6:26AM
    Thank you for your reply.

    Same data on both systems. Target system is a secondary computer I use for testing with a fresh
    install of Windows 10 and my application. Data is available on screen, I just can't generate the print out.

    The print preview appears with 0 of 0 pages. There should be 2 pages generated from the concatenation
    of 2 FastReport templates. InitReport and LoadReport below are both internal routines that use the FastReport
    TfrxReport.LoadFromFile function with a few initializations and verification that the FR3 file exists before attempting
    to load it.

    ...
    frmReport := InitReport(_GrrType2Data);
    frmReport.OnBeforePrint := onBeforePrint;
    frmReport.OnGetValue := onGetPrintValue;
    frmReport.PrepareReport;

    frmReport.LoadReport(_Aiag_4th_Avg_Range_Calc);
    frmReport.OnGetValue := onGetCalcPrintValue;
    frmReport.PrepareReport;

    frmReport.ShowPreparedReport;
    ...

    I placed ShowMessage statements in the OnBeforePrint and OnGetValue event handlers to verify they are being executed
    and they are not. The only thing that makes sense to me is that the TfrxReport.LoadFromFile call is failing but it is returning
    a value of TRUE.
  • edited 6:26AM
    Solved.

    Reports are inherited from a BaseReport which was not included in the distribution.

Leave a Comment