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

Doubt on Tech Tip

edited March 2005 in General
What exactly should be done at this line: "{add logic here to locate
the record and return True if it is found}"

And where is the function 'myLocateReportFunction' ??

I don?t how to use the the Tech Tip and i have the same problem of
loading a template, and SOMETIMES the template is not loaded with the error
message "report not found".


Marcelo

----------------------------------------


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 really need Folder_Id, Name to locate
a record uniquely.

To override this default behavior, you can 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;

Comments

  • edited March 2005
    Hi Marcelo,

    The myLocateReportFunction is a method you create in order to locate the
    record and return True if it is found. For instance, you would add logic to
    traverse through each record in the FolderID and Name fields in your Items
    table and if you find a match to the parameters sent in, return True.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.