Skip to content

ReportTableColumnName - cDRReport

Methods - Properties - Events

Method Type

Function

Return Type

String

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.
hTable Handle of an OPENed table in the DataFlex application.
hColumn Handle of a column in the OPENed table.

Description

Returns the name of a table and column reference to be used with AddFilter. It is a helper function to make the table.column reference easier and not hard coded in the program.

The function calls the DataFlexTableName function to retrieve the name of the table opened in the DataFlex application. This table name is compared against the table names used in the report definition. If the table name matches and the column name also matches, the TableAliasName result is used to construct the {table.column} reference that can be used with 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'

    Procedure OnInitializeReport
        Integer eOutputDeviceMode

        Forward Send OnInitializeReport

        // Convert from the ReportView Output_Device_Mode to peOutputDestination
        Get Output_Device_Mode to eOutputDeviceMode
        Set peOutputDestination to eOutputDeviceMode

        Send SetFilters
    End_Procedure

    Procedure SetFilters
        String sReportId
        Integer[] iCustomerCustomerNumbers
        String sColumnName

        Get psReportId to sReportId

        Get Value of oFromCustomerCustomerNumber to iCustomerCustomerNumbers[0]
        Get Value of oToCustomerCustomerNumber to iCustomerCustomerNumbers[1]

        If (iCustomerCustomerNumbers[0] > iCustomerCustomerNumbers[1]) Begin
            Move (SortArray (iCustomerCustomerNumbers)) to iCustomerCustomerNumbers
        End

        Get ReportTableColumnName sReportId File_Field Customer.Customer_Number to sColumnName

        If (iCustomerCustomerNumbers[0] <> 0) Begin
            Send AddFilter sReportId sColumnName C_DRGreaterThanOrEqual iCustomerCustomerNumbers[0]
        End
        If (iCustomerCustomerNumbers[1] <> 0) Begin
            Send AddFilter sReportId sColumnName C_DRLessThanOrEqual iCustomerCustomerNumbers[1]
        End
    End_Procedure
End_Object

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

    Procedure OnClick
       Send RunReport of oReport
    End_Procedure
End_Object