Question
“How can I select a default report explorer folder for my end-users to save their reports?”
Solution
The following example uses the Report.Template.OnNew and OnLoadEnd events to set the default folder for the user to save reports.
Download: ReportExplorerSelectDefaultFolder.zip
Sample Delphi code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
procedure TmyEndUserSolution.ehReport_New(Sender: TObject); begin ppReportExplorer1.CurrentFolderId := GetFolderId('Customers'); end; procedure TmyEndUserSolution.ehReport_LoadEnd(Sender: TObject); begin ppReportExplorer1.CurrentFolderId := GetFolderId('Customers'); end; function TmyEndUserSolution.GetFolderId(aFolderName: String): Integer; var lsFieldNames: String; lbFolderExists: Boolean; begin // key is folder name, parent id lsFieldNames := ppReportExplorer1.FolderFieldNames.Name + ';' + ppReportExplorer1.FolderFieldNames.ParentId; // locate the folder record lbFolderExists := ppReportExplorer1.FolderPipeline.Locate(lsFieldNames, VarArrayOf([aFolderName, 0]), [pploCaseInsensitive]); // return the folder id if lbFolderExists then Result := ppReportExplorer1.FolderPipeline[ppReportExplorer1.FolderFieldNames.FolderId] else Result := 0; end; |