|
4 | 4 | [](https://docs.devexpress.com/GeneralInformation/403183) |
5 | 5 | [](#does-this-example-address-your-development-requirementsobjectives) |
6 | 6 | <!-- default badges end --> |
7 | | -# DevExpress VCL Reports - Store Report Layouts in a Database |
8 | 7 |
|
9 | | -This example stores a [report layout](https://docs.devexpress.com/VCL/dxReport.TdxReport.Layout) (XML-based template) in the BLOB field of a memory-based dataset ([TdxMemData](https://docs.devexpress.com/VCL/dxmdaset.TdxMemData) inherited from the [TDataSet](https://docwiki.embarcadero.com/Libraries/Athens/en/Data.DB.TDataSet) class shipped with the standard VCL library). |
| 8 | +# DevExpress Reports for Delphi/C++Builder – Store Report Layouts in a Database |
10 | 9 |
|
11 | | -## Testing the example |
| 10 | +This example application stores [DevExpress report layouts][TdxReport.Layout] in a database. |
| 11 | +The application allows users to create and save report layouts, modify existing layouts, and open layouts in Report Designer/Viewer. |
| 12 | + |
| 13 | + |
| 14 | +## Prerequisites |
| 15 | + |
| 16 | +[DevExpress Reports Prerequisites][req] |
| 17 | + |
| 18 | +[req]: https://docs.devexpress.com/VCL/405773/ExpressCrossPlatformLibrary/vcl-backend/reports-dashboards-app-deployment#vcl-reportsdashboards-prerequisites |
| 19 | + |
| 20 | +## Implementation Details |
| 21 | + |
| 22 | +The example application stores report layouts in the BLOB field of a memory-based dataset |
| 23 | +([TdxMemData] from the DevExpress library, inherited from [TDataSet], shipped with the standard VCL library). |
| 24 | +Follow the steps below to store report layouts in a database of your choice, using the corresponding `TDataSet` descendant. |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +## Test the Example |
12 | 29 |
|
13 | 30 | * Run the sample app and click **New Report** to create an empty database record. |
14 | | -* Click **Show Designer** to display the [Report Designer](https://docs.devexpress.com/XtraReports/119176/web-reporting/web-end-user-report-designer) dialog. |
| 31 | +* Click **Show Designer** to display the [Report Designer][dx-report-designer] dialog. |
15 | 32 | * Create a report layout using tools available within the UI. |
16 | 33 | * Click the hamburger button, select the **Save** option, and close the dialog. |
17 | | -* Close the app. The [TdxMemData](https://docs.devexpress.com/VCL/dxmdaset.TdxMemData) component will store layout data between sessions. |
18 | | -* Run the sample app again. Click **View Designer** to load the saved report layout, or **View Report** to preview a layout-based report in the [Report Viewer](https://docs.devexpress.com/XtraReports/401850/web-reporting/web-document-viewer) dialog. |
| 34 | +* Close the app. The [TdxMemData] component will store layout data between sessions. |
| 35 | +* Run the sample app again. Click **View Designer** to load the saved report layout, or **View Report** to preview a layout-based report in the [Report Viewer][dx-report-viewer] dialog. |
| 36 | + |
| 37 | +## Files to Review |
| 38 | + |
| 39 | +- [uData.pas] (Delphi) and [uData.cpp] (C++Builder) read and store data in the database. |
| 40 | +- [uMainForm.pas] (Delphi) and [uMainForm.cpp] (C++Builder) supply layout data from the data module to [TdxReport.Layout] and display Report Designer and Viewer. |
| 41 | +- [nwind.db] contains the Northwind sample database used as a data source for report content. |
| 42 | + |
| 43 | +[uData.pas]: ./Delphi/uData.pas |
| 44 | +[uData.cpp]: ./CPB/uData.cpp |
| 45 | +[uMainForm.pas]: ./Delphi/uMainForm.pas |
| 46 | +[uMainForm.cpp]: ./CPB/uMainForm.cpp |
| 47 | +[nwind.db]: ./Delphi/nwind.db |
19 | 48 |
|
20 | 49 | ## Documentation |
21 | 50 |
|
22 | | -* [TdxReport.Layout Property](https://docs.devexpress.com/VCL/dxReport.TdxReport.Layout) |
23 | | -* [TdxBackendDataSetJSONConnection Component](https://docs.devexpress.com/VCL/dxBackend.ConnectionString.JSON.DataSet.TdxBackendDataSetJSONConnection) |
| 51 | +- [Introduction to VCL Reports][reports-intro] |
| 52 | +- [Tutorial: Create a table report using the Report Wizard][report-wizard] |
| 53 | +- [Store report layouts in REPX files at design-time][reports-design-time-store] |
| 54 | +- [Use SQLite as a data source for reports (as demonstrated in the current example)][sqlite-data-source] |
| 55 | +- API reference: |
| 56 | + - [TdxReport.Layout] (an XML-based layout template that can be stored in the BLOB field of a database) |
| 57 | + - [TdxMemData] (used to store report layout data between sessions) |
| 58 | + - [TdxBackendDatabaseSQLConnection] (used to supply data to reports) |
| 59 | + |
| 60 | +<!-- documentation links --> |
| 61 | +[reports-intro]: https://docs.devexpress.com/VCL/405469/ExpressReports/vcl-reports |
| 62 | +[report-wizard]: https://docs.devexpress.com/VCL/405760/ExpressReports/getting-started/create-table-report-using-report-wizard |
| 63 | +[reports-design-time-store]: https://docs.devexpress.com/VCL/dxReport.TdxReport.Layout#string-list-editor |
| 64 | +[sqlite-data-source]: https://docs.devexpress.com/VCL/405750/ExpressCrossPlatformLibrary/vcl-backend/database-engines/vcl-backend-sqlite-support |
| 65 | +[dx-report-viewer]: https://docs.devexpress.com/XtraReports/401850/web-reporting/web-document-viewer |
| 66 | +[dx-report-designer]: https://docs.devexpress.com/XtraReports/119176/web-reporting/web-end-user-report-designer |
| 67 | + |
| 68 | + |
| 69 | +<!-- reference links --> |
| 70 | +[TdxReport.Layout]: https://docs.devexpress.com/VCL/dxReport.TdxReport.Layout |
| 71 | +[TdxBackendDatabaseSQLConnection]: https://docs.devexpress.com/VCL/dxBackend.ConnectionString.SQL.TdxBackendDatabaseSQLConnection |
| 72 | +[TdxBackendDataSetJSONConnection]: https://docs.devexpress.com/VCL/dxBackend.ConnectionString.JSON.DataSet.TdxBackendDataSetJSONConnection |
| 73 | +[TdxMemData]: https://docs.devexpress.com/VCL/dxmdaset.TdxMemData |
| 74 | +[TDataSet]: https://docwiki.embarcadero.com/Libraries/Athens/en/Data.DB.TDataSet |
| 75 | + |
| 76 | +<!-- external documentation links --> |
| 77 | +<!-- in-repository links --> |
| 78 | + |
| 79 | +## More Examples |
| 80 | + |
| 81 | +- [Store report layouts in REPX files (example application)][file-example] |
| 82 | + |
| 83 | +[file-example]: https://github.com/DevExpress-Examples/vcl-reports-store-layout-template-file |
| 84 | + |
24 | 85 | <!-- feedback --> |
25 | 86 | ## Does This Example Address Your Development Requirements/Objectives? |
26 | 87 |
|
27 | 88 | [<img src="https://www.devexpress.com/support/examples/i/yes-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=vcl-reports-store-layout-template-database&~~~was_helpful=yes) [<img src="https://www.devexpress.com/support/examples/i/no-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=vcl-reports-store-layout-template-database&~~~was_helpful=no) |
28 | 89 |
|
29 | 90 | (you will be redirected to DevExpress.com to submit your response) |
30 | 91 | <!-- feedback end --> |
31 | | - |
32 | | - |
33 | | - |
|
0 commit comments