Skip to content

AddRecordSortField - cDRReport

Methods - Properties - Events

Method Type

Procedure

Arguments

Argument Description
sReportId ID of the main report or the ID of a sub-report. This argument can be passed as an empty string. The empty string can be written as C_USEMAINDRREPORTID.
sSortField One of the fields used in the report.
eSortOrder Ascending or descending sorting.

Description

Adds a field to the record sort order in the report in the same way as the DataFlex Reports designer does in the record sort expert dialog.

The field name needs to be passed – as for example in AddFilter and psFilterFunction – between curly braces and must exist in the report. Failing to specify a valid field results in an error.

You can remove the existing record sort fields by sending RemoveAllRecordSortFields to the report object.

This method cannot be used before the report OCX object is initialized. The COM object creation is - when not done before - created as part of the OpenReport method.

DataFlex Framework usage

  • Web
  • Windows
  • FlexTron

Sample

Object oReport is a cDRReport
    Set psReportName to 'MyReport.dr'
End_Object

Object oRunReportButton is a Button
    Set Label to 'Run Report'

    Procedure OnClick
        String sReportId
        Get OpenReport of oReport to sReportId
        If (sReportId <> '') Begin
            Send AddRecordSortField of oReport sReportId '{orderdetail.price}' C_drDescending
            Send DisplayReport of oReport
        End
    End_Procedure
End_Object