Skip to content

AddFilter - cDRReport

Methods - Properties - Events

Method Type

Procedure

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.
sField One of the fields used in the report.
eOperator One of the filter operator constants.
sFilterValue A value to filter against.

Description

Adds a record filter to the report in the same way as the DataFlex Reports designer does in the filter 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.

A field name can be constructed by calling the ReportTableColumnName function. Note that this function requires tables to be opened and will be always slower than when using a constant string.

Existing filters can be removed by sending RemoveAllFilters.

When the filter value is a date or datetime, call DateToString or DataTimeToString before passing this to AddFilter.

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 AddFilter of oReport sReportId "{orderdetail.quantity}" C_drGreaterThanOrEqual 20
            Send DisplayReport of oReport
        End
    End_Procedure
End_Object