Skip to content

ReportsCacheFolder - cDRReport

Methods - Properties - Events

Method Type

Function

Return Type

String

Arguments

None

Description

This function returns the default reports cache folder location. The default folder is a folder named Cache in the Reports folder (e.g., c:\examples\weborder\reports\cache). The function utilizes the ReportsFolder function and is used by the [ReportCacheFileName](report-cache-file-name.md

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

You should augment this function when the ReportsFolder returns an empty string or when the folder is not a sub-folder of the ReportsFolder.

This function is only available for DataFlex 17.1 and higher and is designed to be used with the Web Application Framework.

DataFlex Framework Usage

  • Web
  • Windows
  • FlexTron

Sample

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

    // Augmented function as temp files need to be stored globally on this machine
    Function ReportsCacheFolder Returns String
        Function_Return 'c:\tmp'
    End_Function
End_Object

#IFDEF IS$WEBAPP
Send RegisterDownloadFolder of ghoWebResourceManager 'c:\tmp'
#ENDIF

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

    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