What type of error did you receive? Was this a new template you just created using the demo, or was it an existing one already stored on your Advantage database?
--------------------------------------------------------------- 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.
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);
Comments
Take a look at the example located in the \RBuilder\Demos\4. EndUser
Databases\Advantage\... directory.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik (Digital Metaphors) ha scritto:
Uhm.....I got an error on Report.Template.LoadFromDatabase! On what
depending this error in your mind?
What type of error did you receive? Was this a new template you just
created using the demo, or was it an existing one already stored on your
Advantage database?
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
the error is "Access violation at address 005A1800 in module..."
Instead the template was an existing one in the table rbItem, created
with ReportExplorer!
Thanks in advance
Andrea
Nico Cizik (Digital Metaphors) ha scritto:
Take a look at the following article.
---------------------------------------------------------------
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;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
You are my salvation......
Best regards
Andrea
Nico Cizik (Digital Metaphors) ha scritto: