Skip to content

TableData - cDRReport

Methods - Properties - Events

Method Type

Procedure

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.
iTable The N-th RDS table in the report. Table numbers start at zero.
vTableData A two-dimensional array with rows and columns of data for the report.

Description

Passes the data from your application to the report to be used as RDS data source.

The 2nd dimension of the array must exactly match the data source description in the report.

The data type in the 2nd dimension of the array must match with the column data-type description in the RDS data source. This means that you cannot pass a string with characters where an integer is expected.

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

  • Windows
  • FlexTron
  • Web

Web Sample

Object oFileListReportResults is a cWebView
    Set psCaption to "Results"

    Object oReport is a cDRReport
        Set psReportName to "FileListRDS.dr"

        Procedure LoadData String sReportId
            Variant[][] vData
            Handle hTable
            Integer iRow
            Boolean bShowHidden
            String sDisplayName
            tWebNavigateData NavigateData

            Get GetNavigateData to NavigateData
            Get NamedValueGet NavigateData.NamedValues "ShowHiddenTables" to bShowHidden
            Get_Attribute DF_FILE_NEXT_USED of hTable to hTable
            While (hTable <> 0)
                Get_Attribute DF_FILE_DISPLAY_NAME of hTable to sDisplayName
                If ((bShowHidden) or ((Left (sDisplayName, 1) <> '@') and (not (bShowHidden)))) Begin
                    Move hTable to vData[iRow][0]
                    Get_Attribute DF_FILE_ROOT_NAME of hTable to vData[iRow][1]
                    Move sDisplayName to vData[iRow][2]
                    Get_Attribute DF_FILE_LOGICAL_NAME of hTable to vData[iRow][3]
                    Increment iRow
                End
                Get_Attribute DF_FILE_NEXT_USED of hTable to hTable
            Loop

            Send TableData sReportId 0 vData
        End_Procedure

        Procedure OnInitializeReport
            String sReportId

            Forward Send OnInitializeReport

            Get psReportId to sReportId
            Send LoadData sReportId
        End_Procedure
    End_Object

    Object oWebMainPanel is a cWebPanel
        Object oViewer is a cWebDRReportViewer
            Set phoReport to oReport

            WebSetResponsive pbShowToolbar rmTablet to False
        End_Object
    End_Object

    Procedure OnNavigateForward tWebNavigateData NavigateData Handle hoInvokingView Handle hoInvokingObject
        Forward Send OnNavigateForward NavigateData hoInvokingView hoInvokingObject

        Send ShowReport of oViewer
    End_Procedure
End_Object

Windows Sample

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

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

    Procedure OnClick
        String sReportId
        Variant[][] vData
        Integer iRowElement

        Get OpenReport of oReport to sReportId
        If (sReportId <> '') Begin
            Send Request_Read of oCustomer_DD FIRST_RECORD Customer.File_Number 1
            While (Found)
                Move (Trim(Customer.Name)) to vData[iRowElement][0]
                Move (Trim(Country.Name)) to vData[iRowElement][1]
                Increment iRowElement
                Send Locate_Next of oCustomer_DD
            Loop

            Send TableData of oReport sReportId 0 vData
            Send DisplayReport of oReport
        End
    End_Procedure
End_Object