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

Report Explorer x Report.Template.LoadFromDatabase

edited April 2004 in End User
Hi,

I have an Delphi5/RBuilder 6.03 app that uses Report Explorer to show the
EndUser reports, and all reports works fine. In other place in the same app,
I call reports using Report.Template.LoadFromDatabase, and I get the
following message:

"Error reading ppReport.AfterAutoSearchDialogCreate. Invalid property value"

What's wrong ?

Thanks,

Mauro

Comments

  • edited April 2004

    1. To load a template stored to the Report Explorer database tables, please
    see the article below.

    2. That error indicates that the event-handler method cannot be found. The
    event-handler method needs to be a published method of the report.Owner.
    Typically the Owner of the report is the form/datamodule upon which the
    Report component resides. This is how standard Delphi object streaming
    works.




    ---------------------------------------------------------------
    Tech Tip: How to Programmatically Load Reports that were Saved
    using the Report Explorer
    ---------------------------------------------------------------

    1. The ReportExplorer has a run-time interface you can use to load reports
    using the ReportExplorer.LoadReport method. You can use this method without
    actually 'showing' the report explorer form. (See the online help topic for
    TppReportExplorer.)

    2. If you want use Report.Template.LoadFromDatabase, RB will locate the
    report stored in the database table based upon the NameField value only.
    However, for the rb_item table you need Folder_Id, Name to locate a record
    uniquely.

    To override this default behavior, assign an event-handler to the
    Report.Template.OnLocateRecord event.

    example:

    TmyForm = class(TForm)
    private
    function ReportLocateRecordEvent(Sender: TObject; const aReportName:
    String): Boolean;

    end;

    procedure TmyForm.FormCreate(Sender, TObject);
    begin
    {assign the event handler}
    FReport.Template.OnLocateRecord := ReportLocateRecordEvent;

    end;


    function TmyForm.ReportLocateRecordEvent(Sender: TObject; const aReportName:
    String): Boolean;
    begin
    {add logic here to locate the record and return True if it is found}

    Result := myLocateReportFunction(FFolderid, aReportname);

    end;



    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.