Skip to main content
You are viewing help content for pre-release software. This document and the features it describes are subject to change.
All docs
V25.2
  • TdxBackendDataSetJSONConnection Class

    A component designed to fetch data from one or multiple datasets (TDataSet descendant instances).

    Declaration

    TdxBackendDataSetJSONConnection = class(
        TdxBackendCustomInMemoryJSONConnection
    )

    Remarks

    TdxBackendDataSetJSONConnection is a data connection component designed to bind a backend client component to one or multiple datasets (TdxMemData, TFDTable, TFDQuery, etc.) like any other data-aware VCL control (TcxGrid, for instance).

    The TdxBackendDataSetJSONConnection component serializes data from associated datasets and stores it in memory in the JSON format[1] compatible with the DevExpress Reports for Web engine (used as the base for TdxReport).

    Main API Members

    The list below outlines key members of the TdxBackendDataSetJSONConnection class. These members allow you to configure data connection settings.

    Data Connection Settings

    Active
    Specifies if the data connection is active.
    AutoRefreshData
    Specifies if the data connection component automatically reloads data from associated datasets every time a backend client component starts to populate placeholders with data.
    DisplayName
    Specifies the data connection’s name in both designer and Collection Editor dialogs.
    ConnectionString
    Provides access to serialized data (in the JSON format) from associated datasets. Use the DataSets property to manage the source dataset collection.
    DataSets
    Allows you to manage source datasets.

    General-Purpose API Members

    Collection | Index
    Specify the parent collection component.

    Code Example: Load and Populate Report Templates from Datasets

    This code example loads an XML-based report template (REPX) from a dataset, configures export settings, populates the template with data from another dataset, and displays the report preview:

    uses
      dxReport,  // Declares the TdxReport component and related types
      dxBackend.ConnectionString.JSON.DataSet;  // Declares the TdxBackendDataSetJSONConnection component
    // ...
    
    procedure TMyForm.Button1Click(Sender: TObject);
    var
      ADataConnection: TdxBackendDataSetJSONConnection;
      AReport: TdxReport;
      ALayoutStream: TStream;
    begin
      ADataConnection := TdxBackendDataSetJSONConnection.Create(Self);
      try
        ADataConnection.Name := 'DataSetJSONData';
        ADataConnection.DataSets.Add('Data', FDataSet);
        AReport := TdxReport.Create(Self);
        try
          AReport.ReportName := 'Report';
          ALayoutStream := FLayoutDataSet.CreateBlobStream(FLayoutDataSet.FieldByName('Layout'), bmRead);
          try
            AReport.Layout.LoadFromStream(ALayoutStream);
          finally
            ALayoutStream.Free;
          end;
          AReport.Language := 'fr-FR';
          AReport.ExportFormats := [TdxReportExportFormat.PDF,
            TdxReportExportFormat.RTF, TdxReportExportFormat.HTML];
          AReport.FilterString := 'id = 5';
          AReport.ShowViewer;
        finally
          AReport.Free;
        end;
      finally
        ADataConnection.Free;
      end;
    end;
    

    Indirect TdxBackendDataSetJSONConnection Class References

    The following public API members reference the TdxBackendDataSetJSONConnection class as a TdxBackendCustomDataConnection object:

    TdxBackendDataConnectionCollection.Add
    Creates a data connection of the required type and ads the connection to the collection.
    TdxBackendDataConnectionCollection.Items
    Provides indexed access to all data connection components stored in the collection.
    TdxBackendDataConnectionManager.Items
    Provides indexed access to stored data connection components.

    Other Backend Data Connection Components

    TdxBackendInMemoryJSONConnection
    A component designed for interaction with data stored in memory.
    TdxBackendDatabaseSQLConnection
    A component designed to fetch data from an SQL database (SQL Server, PostgreSQL, SQLite, etc.).

    To see TdxDashboardControl and TdxReport components in action, run BI Dashboards Designer/Viewer and Report Designer/Viewer demos in the VCL Demo Center installed with compiled VCL DevExpress demos. Click different items in the sidebar on the left to switch between demo features.

    Download: Compiled VCL Demos

    Tip

    You can find full source code for installed compiled Report and Dashboard demos in the following folders:

    • %PUBLIC%\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressReports\
    • %PUBLIC%\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressDashboards\
    Footnotes
    1. You can use the ConnectionString property to access serialized dataset content (as a string in the JSON format).

    See Also