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

    • 5 minutes to read

    The VCL Backend implementation allows you to bind TdxDashboard/TdxDashboardControl and TdxReport/TdxReportControl components to one or more 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 retrieved data, and stores it in memory in 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 TdxDashboard/TdxDashboardControl and TdxReport/TdxReportControl components:

    ExpressDashboards Tutorials

    Read Tutorial: Create a Dashboard

    Basic Tutorial. Follow this tutorial to create a simple dashboard application: set up a memory-based data source, load JSON data, create Bubble Map and Chart dashboard items, and bind them to data.

    Featured Components: TdxDashboardControl | TdxBackendDataConnectionManager | TdxBackendInMemoryJSONConnection

    Read Tutorial: Bind a Dashboard to FireDAC Data

    Follow this tutorial to create a dashboard and bind it to data using standard FireDAC components (TFDQuery and TFDConnection) shipped with the RAD Studio IDE.

    Featured Components: TdxDashboardControl | TdxBackendDataConnectionManager | TdxBackendDataSetJSONConnection

    Read Tutorial: Bind a Dashboard to a Stored Procedure

    Follow this tutorial to create a dashboard, bind it to a parametrized stored procedure, and pass dashboard parameters to that procedure using the Dashboard Designer dialog at design time.

    Featured Components: TdxDashboardControl | TdxBackendDataConnectionManager | TdxBackendDatabaseSQLConnection

    ExpressReports Tutorials

    Read Tutorial: Create a Table Report Using JSON Data Read Tutorial: Bind a Table Report to FireDAC Data

    Basic Tutorials designed to help you get acquainted with basic tools and report creation functionality available for TdxReport and TdxReportControl components.

    Follow these tutorials to create a table report and display it in a VCL application. Both tutorials create applications with the same UI/UX but use different data sources and data connection components.

    Read Tutorial: Tabbed MDI Report Viewer (SQL Database) Read Tutorial: Tabbed MDI Report Viewer (FireDAC)

    Parametrized Report Tutorials. Follow these tutorials to create a Tabbed MDI (multi-document interface) Report Viewer application where different tabs allow users to display the same parametrized report layout/template populated with different data loaded from a relational SQL database.

    Both tutorials create sample applications that implement the same UI/UX with similar performance but rely on different data shaping/connection techniques/components.

    Tip

    Refer to the following topic for a complete list of TdxReport/TdxReportControl tutorials: VCL Reports: Getting Started.

    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