Skip to content

ReportsFolder - cDRReport

Methods - Properties - Events

Method Type

Function

Return Type

String

Arguments

None

Description

This function returns the default reports folder location. The default folder is a folder named Reports in the workspace root folder (e.g., c:\examples\weborder\reports\). The function is used by the ReportCacheFolder function and indirectly by the ReportCacheFileName function.

The path ends on a backslash, e.g., c:\examples\weborder\reports\.

An empty string is returned if there is no such folder or if there is no cApplication object.

Augment this method when the workspace does not contain a folder named Reports (as a sibling of Data, AppHtml, etc.).

DataFlex Framework Usage

  • Web
  • Windows
  • FlexTron

Sample

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

    // Augmented method as the workspace does not have a Reports folder
    Function ReportsFolder Returns String
        Handle hoWorkspace
        String sFolder

        Get phoWorkspace Of ghoApplication to hoWorkspace
        Get psHome of hoWorkspace to sFolder
        If (Right (sFolder, 1) <> SysConf (SYSCONF_DIR_SEPARATOR)) Begin
            Move (sFolder - SysConf (SYSCONF_DIR_SEPARATOR)) to sFolder
        End
        Move (sFolder + "MyReports") to sFolder

        Function_Return sFolder
    End_Function
End_Object

Object oExportToPDFButton is a Button
    Set Label to 'Export Report to PDF'

    Procedure OnClick
        String sReportId sFileName
        drPDFExportOptions PDFReportOptions

        Get OpenReport of oReport to sReportId
        If (sReportId <> "") Begin
            Get DefaultPDFExportOptions of oReport to PDFReportOptions
            Set pPDFExportOptions of oReport to PDFReportOptions
            Get ReportCacheFileName of oReport '.pdf' to sFileName
            If (sFileName <> "") Begin
                Send ExportReport of oReport C_drPDF sFileName
            End
            Send CloseReport of oReport sReportId
        End
    End_Procedure
End_Object

Notes

  • This function is only available for DataFlex 17.1 and higher and is designed to be used with the Web Application Framework.
  • In DataFlex Reports 24.0, the psReportPath may return multiple folders.