Bind a Report to a Database/SQL View Using Standard FireDAC and DataSet Components
- 4 minutes to read
This tutorial creates a new project, sets up FireDAC components shipped with the RAD Studio IDE, adds a TdxReport component, and uses the Report Wizard to set up a table report at design time.

Sample SQLite Database
This guide uses the following SQLite database shipped with compiled DevExpress VCL demos:
Tip
%PUBLIC%\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressReports\Data\devav.sqlite3
Step 1 — Create & Configure a RAD Studio Project
Create a new Delphi or C++Builder project.
Place Components on a Form
DevExpress Components
- TdxBackendDataConnectionManager
- Manages data sources for all reports in your application.
- TdxReport
- Manages report document layouts, end-user dialogs, and related settings.
FireDAC Components
- TFDConnection
- A standard component designed to establish a connection to a database management system.
- TFDQuery
- A dataset component designed to execute SQL queries.
- TDataSource
- An interface component designed to connect datasets and data-aware components/controls on a form.

Configure FireDAC Components
FireDAC Connection
Right-click the TFDConnection component and select Connection Editor… to configure the database connection:
- Select SQLite in the Driver ID combo box.
- Click the folder icon for the Database parameter to display the Open File dialog and select the sample SQLite database file.
- Click Test to check if the sample SQLite database (devav.sqlite3) is accessible.
- Leave the Password field empty and click OK in the FireDAC Login dialog to ensure that the connection is established successfully.
- Click OK to close the Connection Editor… dialog.

FireDAC Query
- Double-click the TFDQuery component to display the FireDAC Query Editor dialog.
Paste the following SQL query into the command editor:
SELECT * FROM CUSTOMERSClick Execute to fetch corresponding records from the sample SQLite database:

Close the FireDAC Query Editor dialog and enable the Active property in the Object Inspector.
Data Source
Select the TDataSource component and assign the configured TFDQuery component to the DataSet property using the Object Inspector.

Bind the Report Generator to Data
Double-click the TdxBackendDataConnectionManager component on the form to open the Collection Editor dialog, click the Add button, and select the DataSet (JSON) option to create a TdxBackendDataSetJSONConnection component:

Select the created component and click the ellipsis button for the TdxBackendDataSetJSONConnection.DataSets property in the Object Inspector to display the Collection Editor dialog.

Click the Add New button to create a dataset link (TdxBackendDataSetCollectionItem) for the TdxBackendDataSetJSONConnection component:

Select the created TdxBackendDataSetCollectionItem component and use the Object Inspector to assign the previously configured TDataSource component to the TdxBackendDataSetCollectionItem.DataSource property:

The sample SQLite database is now accessible to the TdxReport component.
Step 2 — Design a Report Layout Using the Report Wizard
Right-click the TdxReport component and select the Designer option to display the Report Designer dialog. Click the hamburger menu in the bottom-left corner to display the Report Designer menu and select Design in the Report Wizard to display available report types:

Select Table Report on the Select Report Type page to create a tabular layout and click Next.

Select JSON on the Select Data Source page to use the previously configured connection component as a data source and click Next.

The Specify Data Source Settings page displays the configured data source. Review the list of loaded dataset fields in the Select data fields pane and click Next.

Check DataSource1 in pane 1, check all required dataset fields in pane 2, and click Finish to create a table report layout with all selected fields.

The Report Designer dialog displays the generated report template:

Next Steps (3, 4, and 5)
To preview/modify the created report template, display Report Designer/Report Viewer dialogs at runtime, and deploy the resulting application, follow steps 3, 4, and 5 of the basic Report Generation Tutorial:
- Step 3 — Modify/Preview & Save the Generated Report Layout
This tutorial step contains basic information on report edit and preview functionality.
Tip
Refer to the following section for detailed information on report layout customization options:
- Step 4 — Display Report Viewer & Designer Dialogs at Runtime
- TdxReport is a non-visual component. Follow this tutorial step to display end-user dialogs at runtime using ShowDesigner and ShowViewer methods.
- Step 5 — Build & Test Your First App
- This step explains how to use post-build events in the RAD Studio IDE for automatic dependency deployment for the TdxReport component.