How To…Programmatically Load Reports Saved Using the Report Explorer

Question

“How do I programmatically load reports that were saved using the Report Explorer ?”

Solution

  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.

Sample Delphi code: