Skip to main content
All docs
V25.1
  • TdxReportDataSetJSONConnection.DataSets Property

    Provides access to the Report dataset collection.

    Declaration

    property DataSets: TdxReportDataSetCollection read; write;

    Property Value

    Type Description
    TdxReportDataSetCollection

    A dataset collection.

    Remarks

    Each Report dataset item in the DataSets collection allows you to use a dataset (a TDataSet descendant instance) as a data source for a TdxReport component.

    The TdxReportDataSetJSONConnection component serializes content from source datasets and stores it in memory in the JSON format compatible with the DevExpress Reports for Web engine (used as the base for TdxReport). You can use the ConnectionString property to access serialized data (if required).

    Available Options

    Call the DataSets.Add method to create a new dataset item as demonstrated in the code example below.

    Refer to the TdxReportDataSetCollection class description for detailed information on all available options.

    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
      dxReport.ConnectionString.JSON.DB;  // Declares the TdxReportDataSetJSONConnection component
    // ...
    
    procedure TMyForm.Button1Click(Sender: TObject);
    var
      ADataConnection: TdxReportDataSetJSONConnection;
      AReport: TdxReport;
      ALayoutStream: TStream;
    begin
      ADataConnection := TdxReportDataSetJSONConnection.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;
    
    See Also