TdxBackendCustomParameters<T>.ParamByName Property
Declaration
property ParamByName[const AName: string]: T read; default;
Property Value
| Type | Description |
|---|---|
| T | The parameter with the name matching the If the collection contains no parameter with the name that matches the |
Remarks
Pass a parameter name to access the corresponding parameter in the collection of report / dashboard parameters.
To avoid an exception if the collection does not contain the target parameter, use the FindParam function. If you know the parameter’s index in the collection, use the Items property to access the target parameter.
Tip
ParamByName is the collection’s default property. You can omit its name and use only the parameter name in square brackets (for example, dxReportControl1.Parameters['ParameterName'] instead of dxReportControl1.Parameters.ParamByName['ParameterName']).
Code Examples
Note
The ParamByName property is common to report and dashboard parameters. These examples perform the same operation but use component-specific APIs.
Fetch Report Parameters by Name
uses
dxReport.Control, // Declares the TdxReportControl class
dxReport.Parameters, // Declares the TdxReportParameter class
dxMessageDialog; // Declares the TdxMessageDialogForm class
procedure TForm1.cxButton1Click(Sender: TObject);
var
ACountryParameter: TdxReportParameter;
ADateParameter: TdxReportParameter;
begin
// Fetch report parameters with specified names
ACountryParameter := dxReportControl1.Parameters.ParamByName['countryParameter'];
ADateParameter := dxReportControl1.Parameters['dateParameter'];
// Display parameter labels
dxShowMessageFmt('Parameter 1: %s' + #13#10 + 'Parameter 2: %s',
[ACountryParameter.Description, ADateParameter.Description]);
end;
Fetch Dashboard Parameters by Name
uses
dxDashboard.Control, // Declares the TdxDashboardControl class
dxDashboard.Parameters, // Declares the TdxDashboardParameter class
dxMessageDialog; // Declares the TdxMessageDialogForm class
procedure TForm1.cxButton1Click(Sender: TObject);
var
ACountryParameter: TdxDashboardParameter;
AYearParameter: TdxDashboardParameter;
begin
// Fetch dashboard parameters with specified names
ACountryParameter := dxDashboardControl1.Parameters.ParamByName['countryParameter'];
AYearParameter := dxDashboardControl1.Parameters['yearParameter'];
// Display parameter labels
dxShowMessageFmt('Parameter 1: %s' + #13#10 + 'Parameter 2: %s',
[ACountryParameter.Description, AYearParameter.Description]);
end;