Skip to content

psRecordSortField - cDRReport

Methods - Properties - Events

Type

String

Default

None

Arguments

Argument Description
sReportID ID of the report. Can be 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.
iSortFieldIndex The index of the sort field

Description

Sets/Gets the field name of the N-th sort field of a report.

Sort fields can be added in the designer via the record sort expert dialog or via the AddRecordSortField method. Trying to set psRecordSortField of a non-existing sort field does not do anything and gives no error.

Use this property together with peRecordSortOrder

This property 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'

    Procedure OnInitializeReport
        String sReportId

        Forward Send OnInitializeReport

        Get psReportId to sReportId
        Set psRecordSortField sReportId 0 to '{Titles.YearPublished}'
    End_Procedure
End_Object

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

    Procedure OnClick
        String sReportId sRecordSortField

        Send RunReport of oReport

        Get psReportId of oReport to sReportId
        Get psRecordSortField of oReport sReportId 0 to sRecordSortField
    End_Procedure
End_Object

Notes

  • The above code assumes that there is one predefined record sort field.