Skip to content

OnError - cDRReport

Methods - Properties - Events

Method Type

Procedure (event)

Arguments

Argument Description
iErrNum The error number.
iErrLine The line at which the error occurred.
sErrMsg The message related to the occurring error.

Description

This event is fired whenever an error occurs.

It is possible to cancel further display of the error by setting the pbDisplayError

DataFlex Framework usage

  • Web
  • Windows
  • FlexTron

Sample

Object oReport is a cDRReport
    // Set the report name to a non-existing report to invoke an error
    Set psReportName to 'NonExistentReport.dr'

    Procedure OnError Integer iErrNum Integer iErrLine String sErrMsg
        Integer iChannel

        Move (Seq_New_Channel ()) to iChannel
        If (iChannel <> DF_SEQ_CHANNEL_NOT_AVAILABLE) Begin
            Append_Output Channel iChannel 'Report.Log'
            WriteLn iErrNum ' ' iErrLine ' ' sErrMsg
            Close_Output Channel iChannel
            Send Seq_Release_Channel iChannel
        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