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
  • TdxBackendDataSetCollection.Add(string,TDataSet) Method

    Creates a new initialized backend dataset item with a specified user-friendly name and adds the item to the collection.

    Declaration

    procedure Add(const ADataSetAlias: string; ADataSet: TDataSet); overload;

    Parameters

    Name Type Description
    ADataSetAlias string

    Specifies a user-friendly dataset name used in designer dialogs.

    This parameter value initializes the DataSetAlias property of the created collection item.

    ADataSet TDataSet

    Specifies the dataset (a TDataSet descendant instance) associated with the created collection item.

    This parameter value initializes the DataSet property of the new collection item.

    Remarks

    Call the Add procedure to create a new backend data collection item and associated with an exsiting dataset. All created collection items are accessible through the Items property.

    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;
    

    Delete Backend Dataset Items

    You can call Delete and Clear procedures to delete backend dataset items stored in the collection.

    See Also