Skip to content

TableCount - 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.

Description

Returns the number of tables in the report.

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

Use Windows.pkg
Use DFClient.pkg
Use File_dlg.pkg
Use cRichEdit.pkg
Use cDRReport.pkg

Deferred_View Activate_oReportInfoView for ;
Object oReportInfoView is a dbView
    Set Border_Style to Border_Thick
    Set Size to 200 350
    Set Location to 4 3
    Set Label to "Report Info"

    Object oReportFileNameForm is a Form
        Set Size to 13 242
        Set Location to 5 50
        Set Prompt_Button_Mode to PB_PromptOn
        Set Label_Col_Offset to 2
        Set Label to "Filename:"
        Set Label_Justification_Mode to JMode_Right
        Set psToolTip to "Report File Name"
        Set peAnchors to anTopLeftRight

        Procedure Prompt
            Boolean bSelected
            String sFileName

            Get Show_Dialog of oReportSelectorDialog to bSelected
            If (bSelected) Begin
                Get File_Name of oReportSelectorDialog to sFileName
                Set Value to sFileName
            End
        End_Procedure
    End_Object

    Object oReportSelectorDialog is a OpenDialog
        Set Filter_String to "DataFlex Reports|*.dr|All Files|*.*"
        Set Dialog_Caption to "Select a DataFlex Reports Report"
    End_Object

    Object oResults is a cRichEdit
        Set Size to 174 284
        Set Location to 20 8

        Procedure AppendBoldText String sText
            Set pbBold to True
            Send AppendText sText
            Set pbBold to False
        End_Procedure
    End_Object

    Object oReport is a cDRReport
        Procedure ShowInfo
            String sFileName sReportId

            Get Value of oReportFileNameForm to sFileName
            If (sFileName <> "") Begin
                Set psReportName to sFileName
                Get OpenReport to sReportId
                If (sReportId <> "") Begin
                    Send ShowNumberOfTables sReportId
                    Send CloseReport sReportId                    
                End
            End
        End_Procedure

        Procedure ShowNumberOfTables String sReportId
            Integer iTables

            Get TableCount sReportId to iTables
            Send AppendBoldText of oResults 'Number of tables: '
            Send AppendTextLn of oResults iTables
        End_Procedure
    End_Object

    Object oShowInfoButton is a Button
        Set Location to 5 294
        Set Label to 'Show Info'

        Procedure OnClick
            Send ShowInfo of oReport
        End_Procedure    
    End_Object
Cd_End_Object