Skip to content

ImportPageLayer - 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.
sSubReportId The report ID of the sub-report to be re-imported.
sFileName Name of the file that contains the sub-report definition.

Description

Returns C_DR_SUBREPORT_IMPORT_SUCCESS on success or one of the error conditions. Consider the whole operation as sensitive. When it fails, it is better to close the report and re-open than try to continue.

The return is one of the SubReportImport Result Codes.

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
  • Windows controls in a FlexTron application

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
        Send RunReport of oReport
    End_Procedure
End_Object

Object oPageLayerComboForm is a ComboForm
    Set Size to 12 100
    Set Location to 300 8
    Set Entry_State to False
    Set Combo_Sort_State to False
    Set peAnchors to anBottomLeft

    Procedure Combo_Fill_List
        Send Combo_Add_Item "DAW Corporate Logo"
        Send Combo_Add_Item "ACME Inc"
    End_Procedure

    Procedure OnChange
        String sValue sReportId sPageLayerId sFileName sFolder
        Integer eStatus

        Get psReportId of oReport to sReportId
        If (sReportId <> "") Begin
            Get PageLayerId of oReport sReportId 0 to sPageLayerId
            If (sPageLayerId <> "") Begin
                Get ReportsFolder of oReport to sFolder
                Get Value to sValue
                If (sValue = "DAW Corporate Logo") Begin
                    Move (sFolder - "DAW Corporate Logo.dpl") to sFileName
                End                    
                Else Begin
                    Move (sFolder - "ACME Inc.dpl") to sFileName
                End
                Get ImportPageLayer of oReport sReportId sPageLayerId sFileName to eStatus
                If (eStatus = C_DR_PAGELAYER_IMPORT_SUCCESS) Begin
                    Send RefreshReport of oReport
                End
            End
        End
    End_Procedure
End_Object