Skip to main content
All docs
V26.1
  • TdxReportParameters Class

    A collection of report parameters.

    Declaration

    TdxReportParameters = class(
        TdxBackendCustomParameters<TdxReportParameter>
    )

    Remarks

    Report parameters are dynamic values that can replace constants in a report query, filter criteria, expressions, and calculated fields. The TdxReportParameters class implements a collection of report parameters.

    The TdxReportParameters collection is automatically populated and updated from the current report template definition. The list of parameter is read-only. You can only access and modify parameter properties.

    Note

    If the list of parameters changes within the report template definition, the collection is updated automatically the next time you access it in code.

    Main API Members

    The list below outlines key members of the TdxReportParameters class. These members allow you to access and modify parameters in a report:

    Count
    Returns the number of parameters stored in the collection.
    FindParam
    Returns the stored parameter with the specified name or returns nil / nullptr if the collection does not contain the target parameter. Use this method to safely search for a parameter that may not exist.
    Items
    Returns the stored parameter by its index in the collection.
    ParamByName
    Returns the stored parameter with the specified name or raises an exception if the collection does not contain the target parameter.

    Note

    You can omit ParamByName and use only the parameter name in square brackets (for example, dxControl1.Parameters['ParameterName'] instead of dxControl1.Parameters.ParamByName['ParameterName']).

    Code Example: List Report Parameters

    uses
      dxReport.Control,      // Declares the TdxReportControl class
      dxReport.Parameters,   // Declares the TdxReportParameter class
      dxMessageDialog,       // Declares the TdxMessageDialogForm class
      System.StrUtils;       // Provides advanced string management routines
    
    procedure TForm1.cxButton1Click(Sender: TObject);
    var
      AList: TStringList;
      AParameter: TdxReportParameter;
    begin
      // Create a TStringList instance
      AList := TStringList.Create;
      try
        // Iterate through report parameters
        for AParameter in dxReportControl1.Parameters do
          AList.Add(Format('- %s', [
            // Use the parameter Name if Description is missing
            IfThen(AParameter.Description <> '', AParameter.Description, AParameter.Name)
          ]));
        // Display the parameter list or a notification message if the list is empty
        if AList.Count > 0 then
          dxShowMessage(AList.Text)
        else
          dxShowMessage('The report has no parameters.');
      finally
        AList.Free;
      end;
    end;
    

    Direct TdxReportParameters Class Reference

    The following public API members reference a TdxReportParameters object:

    TdxReport.Parameters
    Provides access to the collection of report parameters.
    TdxCustomReportControl.Parameters
    Provides access to the report parameters collection.
    See Also