RRW (Rave Reports Wrapper)

Source: source/classes/rrw.prg

Standalone class

RRW is a wrapper class for the Rave Reports (RRW) runtime engine. It manages report execution via a control file (DBF-based report registry), generates a temporary .CNT control file, launches the RRWRUN.EXE engine as an external process, and collects execution results. Reports are defined in a control DBF (default RREPORTS.DBF) and executed by name.

Key DATA Members

DATATypeDescription
cRi_ReportCharacterReport name to execute
cRi_OutFileCharacterOutput file path for results
cRi_PrinterCharacterPrint mode: "P"=printer, "D"=preview
cRi_FilterCharacterOptional filter expression
cRi_QueryCharacterQuery mode: "S"=silent, "?"=prompt, "O"=filter
nRi_CopiesNumericNumber of copies to print
lActiveLogicalIs the report object active and ready
cDataDirectoryCharacterData file directory
cLibDirectoryCharacterReport library directory
cControlFileCharacterPath to the generated .CNT control file
cOutFileCharacterPath to the .OUT results file
aResultsArrayExecution results: { ecode, emsg, nReports, nPages, nRecNo }

Methods

MethodDescription
New( cControlFile, cReport, lQuery, lPreview, nBegPage, nEndPage, cDataDirectory, cLibDirectory, cTempDir, cOutFile )Initialize a report run: open the control DBF, locate the report, generate the .CNT control file
End()Close database areas and mark as inactive
Print()Execute the report via RRWRUN.EXE and collect results
Activate()Alias for Print()
SetFilter( cVar )Set a filter expression and switch to filter query mode
SetPrinter( cVar )Set the printer name in the control file
Results()Read the .OUT results file; returns array with error code, message, report count, page count, record number
ShowError()Display a message box with the execution error details

Example: Execute a Rave Report

#include "FiveWin.ch"

function Main()

   local oReport

   oReport := RRW():New( "RREPORTS.DBF", "Invoice", .F., .T., 1, 99999, ;
                         "\data", "\reports" )

   if oReport != nil
      oReport:Print()
      if oReport:aResults[ 1 ] != "0"
         oReport:ShowError()
      else
         MsgInfo( "Report generated successfully" )
      endif
      oReport:End()
   endif

return nil

Notes

See Also