Skip to content

FunctionIdByName - cDRReport

Methods - Properties - Events

Method Type

Function

Return Type

Integer

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.
sFunctionName Name of the function to locate.

Description

Returns the ID of a function defined in the report based on the passed function name.

The test is case insensitive and returns a negative value when it fails. The return values are:

Value Description
-1 No function found with this name
-2 Report engine busy
-3 No report loaded

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 oShowFunctionIDButton is a Button
    Set Label to 'ID of Function2'

    Procedure OnClick
        String sReportId
        Integer iFunctionId

        Get OpenReport of oReport to sReportId
        If (sReportId <> '') Begin
            Get FunctionIdByName of oReport sReportId 'Function2' to iFunctionId
            Send Info_Box ('FunctionID =' * String(iFunctionId))
            Send CloseReport of oReport sReportId
        End
    End_Procedure
End_Object