TdxReportDataSetCollection Class
A collection of Report dataset items.
Declaration
TdxReportDataSetCollection = class(
TcxComponentCollection
)
Remarks
A Report dataset collection manages datasets (TDataSet descendants) for a TdxReportDataSetJSONConnection component.
Main API Members
The list below outlines key members of the TdxReportDataSetCollection
class. These members allow you to manage datasets as data sources for a TdxReport component.
Collection Management APIs
- Add
- Creates a new Report dataset item and adds it to the collection.
- Clear
- Clears the collection.
- Count
- Returns the number of collection items accessible through the Items property.
- Delete
- Deletes individual stored dataset collection items.
- Items
Provides indexed access to stored dataset collection items.
Tip
Cast the returned object to the TdxReportDataSetCollectionItem class to access all public API members.
General-Purpose API Members
- Assign
- Copies datasets between collections.
- BeginUpdate | EndUpdate
- Allow you to avoid redundant notifications during batch collection changes.
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;
Direct TdxReportDataSetCollection Class Reference
The TdxReportDataSetJSONConnection.DataSets property references a TdxReportDataSetCollection
object.