TdxReport.ReportName Property
Specifies the report name used as an identifier for the report template/layout definition.
Declaration
property ReportName: string read; write;
Property Value
| Type | Description |
|---|---|
| string | The report name (case-sensitive). |
Remarks
The TdxReport component requires a specified report name to manage report layouts, generate/display report documents, and associate the main report layout with subreports. Use the ReportName property to associate a report name with the report template/layout definition specified using the Layout property.
Report Name and Scopes/Groups
All TdxReport and TdxReportControl instances initially belong to the same report name scope. All report components that share the same report name are associated with the same layout definition. Any changes made in the Report Designer are applied to all report components with the same report name.
To associate the TdxReport component with a dedicated report name scope, use the GroupName property. All report components with the same GroupName[1] property value belong to the same report name scope.
Report Designer: End-User Functionality
To save the current report template state during the current session, users can click the hamburger button in the Report Designer dialog and select the Save option. If the TdxReport.ReportName property value is an empty string, the Report Designer dialog prompts a user to specify a report name:

The report is saved in memory. Report Viewer and Report Designer dialogs also display the ReportName property value in the form caption.
Code Examples
Save Report Layout Changes to File on Every Change
The following code example saves the current Report layout to a file in the REPX format every time a user saves pending changes in the Report Designer dialog:
uses
dxReport; // Declares the TdxReport class
// ...
procedure TMyForm.dxReport1LayoutChanged(ASender: TdxReport);
begin
ASender.Layout.SaveToFile(ASender.ReportName + '.repx');
end;
Save Report Layout to Database on Every Change
The following code example saves the current report to an existing BLOB dataset field every time a user saves pending changes in the Report Designer dialog:
uses
dxReport, // Declares the TdxReport class
dxmdaset; // Declares the TdxMemData class and related types
// ...
procedure TMyForm.dxReport1LayoutChanged(ASender: TdxReport);
begin
dxMemData1.Edit;
dxMemData1.FieldByName('TemplateName').AsString := ASender.ReportName;
dxMemData1.FieldByName('TemplateLayout').Assign(ASender.Layout);
dxMemData1.Post;
end;
Generate and Export Report Content to PDF File
The following code example configures a memory-based data source (TdxBackendInMemoryJSONConnection), loads an REPX layout, and exports generated content to a file in the Portable Document (PDF) format without user interaction:
uses
dxBackend.ConnectionString.JSON, // Declares the TdxBackendInMemoryJSONConnection component
dxSplashForms, // Declares the TdxSplashFormManager class and related types
dxReport; // Declares the TdxReport class
// ...
procedure TMyForm.cxButtonExportToPDFClick(Sender: TObject);
var
AReport: TdxReport;
AJSONDataConnection: TdxBackendInMemoryJSONConnection;
AMemoryStream: TMemoryStream;
AJSONData: string;
begin
// Define a table that consists of three columns ("id", "Region", and "Sales") and five data rows:
AJSONData :=
'[{"id": 1, "Region": "Asia", "Sales": 4.7685},' + // Row #1
'{"id": 2, "Region": "Australia", "Sales": 1.9576},' + // Row #2
'{"id": 3, "Region": "Europe", "Sales": 3.3579},' + // Row #3
'{"id": 4, "Region": "North America", "Sales": 3.7477},' + // Row #4
'{"id": 5, "Region": "South America", "Sales": 1.8237}]'; // Row #5
AJSONDataConnection := TdxBackendInMemoryJSONConnection.Create(Self); // Creates a data connection
try
AJSONDataConnection.Name := 'JSONData'; // Assigns a name to the created data connection
AJSONDataConnection.SetJSONValue(AJSONData); // Assigns the defined JSON data string
AReport := TdxReport.Create(Self); // Creates a TdxReport container
try
AReport.Layout.LoadFromFile('MyReportLayout.repx'); // Loads an REPX Report layout
AReport.ReportName := 'MyReport'; // Defines a Report name
AMemoryStream := TMemoryStream.Create; // Creates a memory stream
TdxSplashFormManager.WaitForm.Show(Self); // Displays a Wait Form before the export operation
try
// Export Report content to the created memory stream in the PDF format:
AReport.ExportToPDF(AMemoryStream);
AMemoryStream.SaveToFile(AReport.ReportName + '.pdf'); // Saves the resulting PDF file
finally
AMemoryStream.Free; // Releases the memory stream
TdxSplashFormManager.WaitForm.Hide; // Hides the Wait Form once the operation is complete
end;
finally
AReport.Free; // Releases the TdxReport container
end;
finally
AJSONDataConnection.Free; // Releases the data connection
end;
end;
Related GitHub-Hosted Sample Projects
Default Value
The ReportName property’s default value is an empty string.
The default ReportName property value indicates that the ShowDesigner procedure displays an empty template in the Report Designer dialog, even if the Layout property contains a non-empty template. Any subsequent saved changes made in the Report Designer dialog override both ReportName and Layout property values.
Layout Definition Name Properties in Other Components
- TdxCustomReportControl.ReportName
- Specifies the report name used as an identifier for the report template/layout definition.
- TdxCustomDashboardControl.DashboardName
- Specifies the name used as an identifier for the dashboard layout definition.
- TdxDashboard.Name
- Specifies the name used as an identifier for the dashboard layout definition.