Skip to content

OnReportStatistics - cDRReport

Methods - Properties - Events

Method Type

Procedure

Arguments

Argument Description
iType Holds the statistics type. Can be one of the Report Statistics constants.
iValue The value belonging to the type.

Description

This procedure can be used to display or collect the report statistics information that can help in discovering where the time is spent.

DataFlex Framework Usage

  • Web
  • Windows
  • FlexTron

Sample

Object oReport is a cDRReport
    Set psReportName to 'MyReport.dr'

    Procedure OnReportStatistics Integer iType Integer iValue
        If (iType = C_drFormatPages) Begin
            Set Value of oFormatPage to iValue
        End
    End_Procedure
End_Object

The next example shows how the event can be used in a Web application:

Use cWebModalDialog
Use cWebPanel.pkg
Use cWebButton.pkg
Use cWebForm.pkg
Use cDRAPI.pkg
Use cWebLabel.pkg

Object oDRReportStatisticsDialog is a cWebModalDialog
    Set psCaption to "Report Statistics"
    Set piMinWidth to 400
    Set piMinHeight to 200

    Object oMainPanel is a cWebPanel
        Object oReportOpen is a cWebLabel
            Set psLabel to "Report Open:"
            Set pbShowLabel to True
            Set psCaption to '--- ms'
            Set peLabelAlign to alignRight
            Set psCSSClass to "StatisticsValue"
        End_Object

        Object oReportExecutionPlan is a cWebLabel
            Set psLabel to "Execution Plan:"
            Set pbShowLabel to True
            Set psCaption to '--- ms (ODBC Only)'
            Set peLabelAlign to alignRight
            Set psCSSClass to "StatisticsValue"
        End_Object

        Object oReportExecution is a cWebLabel
            Set psLabel to "Execution:"
            Set pbShowLabel to True
            Set psCaption to '--- ms (ODBC Only)'
            Set peLabelAlign to alignRight
            Set psCSSClass to "StatisticsValue"
        End_Object

        Object oReadRecords is a cWebLabel
            Set psLabel to "Read Records:"
            Set pbShowLabel to True
            Set psCaption to '--- ms'
            Set peLabelAlign to alignRight
            Set psCSSClass to "StatisticsValue"
        End_Object

        Object oSortRecords is a cWebLabel
            Set psLabel to "Sort Records:"
            Set pbShowLabel to True
            Set psCaption to '--- ms'
            Set peLabelAlign to alignRight
            Set psCSSClass to "StatisticsValue"
        End_Object

        Object oCountPages is a cWebLabel
            Set psLabel to "Count Pages:"
            Set pbShowLabel to True
            Set psCaption to '--- ms'
            Set peLabelAlign to alignRight
            Set psCSSClass to "StatisticsValue"
        End_Object

        Object oFormatPages is a cWebLabel
            Set psLabel to "Format Page:"
            Set pbShowLabel to True
            Set psCaption to '--- ms'
            Set peLabelAlign to alignRight
            Set psCSSClass to "StatisticsValue"
        End_Object
    End_Object

    Object oBottomPanel is a cWebPanel
        Set piColumnCount to 8
        Set peRegion to prBottom

        Object oOkButton is a cWebButton
            Set psCaption to C_$OK
            Set piColumnSpan to 2
            Set piColumnIndex to 3

            Procedure OnClick
                Send Ok
            End_Procedure
        End_Object
    End_Object

    Procedure OnSubmit
        Send Ok
    End_Procedure

    Procedure ShowStatisticValue Integer iType Integer iValue
        Case Begin
            Case (iType = C_DRReportOpen)
                WebSet psCaption of oReportOpen to (String (iValue) + ' ms')
                Case Break
            Case (iType = C_DRExecutionPlan)
                WebSet psCaption of oReportExecutionPlan to (String (iValue) + ' ms')
                Case Break
            Case (iType = C_DRExecution)
                WebSet psCaption of oReportExecution to (String (iValue) + ' ms')
                Case Break
            Case (iType = C_DRReadRecords)
                WebSet psCaption of oReadRecords to (String (iValue) + ' ms')
                Case Break
            Case (iType = C_DRSortRecords)
                WebSet psCaption of oSortRecords to (String (iValue) + ' ms')
                Case Break
            Case (iType = C_DRCountPages)
                WebSet psCaption of oCountPages to (String (iValue) + ' ms')
                Case Break
            Case (iType = C_DRFormatPages)
                WebSet psCaption of oFormatPages to (String (iValue) + ' ms')
                Case Break
         Case End
    End_Procedure

    Procedure ShowStatisticsDialog Handle hoReturnObj tNameValuePair[] ReportStatistics
        Integer iElements iElement

        Move (SizeOfArray (ReportStatistics)) to iElements
        For iElement from 0 to (iElements - 1)
            Send ShowStatisticValue ReportStatistics[iElement].sName ReportStatistics[iElement].sValue
        Loop
        Send Popup hoReturnObj
    End_Procedure
End_Object