Skip to main content
All docs
V25.2
  • VCL Reports/Dashboards: How to Use Data Source and Data Set Components

    • 4 minutes to read

    The VCL Backend implementation allows you to bind TdxDashboard/TdxDashboardControl and TdxReport components to one or multiple datasets (TdxMemData, TFDTable, TFDQuery, and other TDataSet descendants) like any other data-aware VCL control (TcxGrid, for instance). The dedicated TdxBackendDataSetJSONConnection component maintains a collection of associated datasets, serializes fetched data, and stores it in memory in the JSON format[1].

    Follow the steps described in this topic to bind a TdxMemData component to TdxReport using TdxBackendDataSetJSONConnection and TDataSource components.

    Sample Data File

    This guide uses the following DAT file shipped with compiled DevExpress VCL Demos:

    Tip

    %PUBLIC$\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressQuantumGrid\Data\Employees.dat[2]

    Download: Compiled VCL Demos

    Create & Configure a RAD Studio App Project

    Create a new project and place TdxReport and TdxBackendDataConnectionManager components on a form.

    DevExpress Dashboards for Delphi/C++Builder: Create a New ExpressReports-Powered Project

    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:

    DevExpress Dashboards & DevExpress Reports for Delphi/C++Builder: Create a Dataset Connection Component

    Add & Populate a Memory-Based Dataset

    Add TdxMemData and TDataSource components on a form.

    DevExpress Dashboards & DevExpress Reports for Delphi/C++Builder: Create Dataset & Datasource Components

    Right-click the TdxMemData component and select the Persistent Editor… option. Click the Get Fields… button to display the Open File dialog.

    DevExpress Dashboards & DevExpress Reports for Delphi/C++Builder: Load Dataset Field Declarations

    Open the following file: %PUBLIC$\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressQuantumGrid\Data\Employees.dat.

    The Persistent Editor displays empty dataset fields loaded from the specified file. Click the Load… button to display the Open File dialog.

    DevExpress Dashboards & DevExpress Reports for Delphi/C++Builder: Empty Dataset Fields

    Select the same Employees.dat file to populate created fields with data.

    DevExpress Dashboards & DevExpress Reports for Delphi/C++Builder: Populated Dataset Fields

    Click Ok to close the Persistent Editor dialog.

    Bind Dataset JSON Connection and Memory-Based Dataset Components

    Select the TDataSource component and associate it with the populated TdxMemData component using the Object Inspector:

    DevExpress Dashboards & DevExpress Reports for Delphi/C++Builder: Associate Data Source and Memory-Based Dataset Components

    Select the TdxMemData component and set the Active property to True:

    DevExpress Dashboards & DevExpress Reports for Delphi/C++Builder: Enable the Memory-Based Dataset

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

    DevExpress Dashboards & DevExpress Reports for Delphi/C++Builder: Open the Dataset Collection Editor

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

    DevExpress Dashboards & DevExpress Reports for Delphi/C++Builder: Create a Dataset Link

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

    DevExpress Dashboards & DevExpress Reports for Delphi/C++Builder: Associate the Dataset Link Component with the Configured Data Source

    The TdxMemData component is now accessible to TdxDashboard/TdxDashboardControl and TdxReport components in the project.

    Access Data Using the Report Designer

    Double-click the TdxReport component to display the Report Designer dialog.

    DevExpress Reports for Delphi/C++Builder: The Report Designer Dialog

    Click the hamburger button to display the Report Designer menu:

    DevExpress Reports for Delphi/C++Builder: The Report Designer Menu

    Click Add Data Source… to review fields loaded from the configured and populated TdxMemData component:

    DevExpress Reports for Delphi/C++Builder: Review Loaded Dataset Fields

    Click Finish to add selected fields to the FIELDS pane of the Report Designer dialog:

    DevExpress Reports for Delphi/C++Builder: The Populated "FIELDS" Pane in the Report Designer Dialog

    Drag & drop listed fields to the report template and use other layout configuration tools available in the Report Designer dialog.

    DevExpress Reports for Delphi/C++Builder: Place Dataset Fields onto the Report Layout

    Next Steps

    Review the following tutorials to get started with TdxDashboardControl and TdxReport components:

    Create a Dashboard Using the Designer Dialog
    Create a dashboard application: configure Bubble Map and Chart dashboard items, and bind them to data at design time.
    Create a Table Report Using the Report Wizard
    Create a simple report application: define a table report layout and bind it to data using the Report Wizard dialog at design time.

    Other Supported Database Systems

    Refer to the following topics for step-by-step instructions on using corresponding database systems for ExpressReports and ExpressDashboards:

    Built-In Support

    In-Memory/Remote Web Service
    The TdxBackendInMemoryJSONConnection component allows you to bind TdxDashboard/TdxDashboardControl and TdxReport components to JSON data defined in code or loaded from a remote Web API service endpoint.
    SQLite
    SQLite is a file-based relational database engine.
    Microsoft SQL/Azure Databases
    Microsoft SQL Server and Azure SQL Database are proprietary relational database management systems developed by Microsoft.

    Database Providers That Require Assembly Deployment

    PostgreSQL
    PostgreSQL is an open-source database management system.
    Oracle Database
    Oracle Database is a proprietary multi-model database management system developed by the Oracle Corporation.
    MySQL
    MySQL is an open-source relational database management system developed by the Oracle Corporation.
    Firebird
    Firebird is an open-source SQL relational database management system.
    Footnotes
    1. You can use the TdxBackendDataSetJSONConnection.ConnectionString property to access serialized dataset content (as a string in the JSON format).

    2. You can use any other DAT file within the same folder.

    See Also