Skip to content

SubReportId - cDRReport

Methods - Properties - Events

Method Type

Function

Return Type

String

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.
iSubReport The N-th sub-report defined.

Description

Returns the ID of the N-th sub-report in a (sub)report. Can be used to set functions, parameters, filter function, and add filters to a sub-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

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

    Procedure EnumerateSubReports String sReportId Integer iLevel
        Integer iSubReports iSubReport
        String sSubReportId

        Get SubReportCount sReportId to iSubReports
        Decrement iSubReports
        For iSubReport from 0 to iSubReports
            Get SubReportId sReportId iSubReport to sSubReportId
            Showln (Repeat ('---', iLevel)) sSubReportId
            Send EnumerateSubReports sSubReportId (iLevel + 1)
        Loop
    End_Procedure
End_Object

Object oOpenReportButton is a Button
    Set Label to 'Open Report'

    Procedure OnClick
        String sReportId

        Get OpenReport of oReport to sReportId
        If (sReportId <> '') Begin
            Showln 'Report ID Main Report: ' sReportId
            Send EnumerateSubReports of oReport sReportId 1
            Send CloseReport of oReport sReportId
        End
    End_Procedure
End_Object