This script is called after the data has been retrieved from the database engine and the report has been prepared for output, but before the report is actually output. You can use this to change the report or output properties or prevent output from occurring.

You can access the running report object through the global variable Report.

A reference to the Stonefield Query Application object, the path for the report file about to be output, the output type ("PREVIEW," "PRINTER," "FILE," or "EMAIL"), and the output file name (blank unless the output type is "FILE").

Return Value
True if the report output should proceed or False if not.

Here's an example that prevents output from being sent to a network drive.

Visual FoxPro

lparameters toApplication as SQApplication, tcReportFileName, ;
  tcOutputType, tcOutputFileName
local llReturn
llReturn = .T.
if tcOutputType = 'FILE' and left(tcOutputFileName, 2) <> 'C:'
  messagebox('Cannot output to network drive.')
  llReturn = .F.
return llReturn


function Main(Application, ReportFileName, OutputType, _
Main = True
if OutputType = "FILE" and left(OutputFileName, 2) <> "C:" then
  msgbox "Cannot output to network drive."
  Main = False
end if
end function


function Main(Application, ReportFileName, OutputType, 
  OutputFileName) {
var ReturnValue ;
ReturnValue = true ;
if (OutputType = 'FILE' && OutputFileName.substring(1, 2) != "C:") {
  ReturnValue = false
return ReturnValue ;


The method in this script must be named ReportEngine_AfterReportPrepared.

public static bool ReportEngine_AfterReportPrepared(SFQApplication sfqApplication,
  string reportFileName, string outputType, string outputFileName)
  bool returnVal = true;
  if (outputType.ToUpper() == "FILE" && outputFileName.Substring(0, 2) != "C:") 
    returnVal = false;
  return returnVal;


The method in this script must be named ReportEngine_AfterReportPrepared.

public shared function ReportEngine_AfterReportPrepared(sfqApplication as SFQApplication,
  reportFileName as string, outputType as string,
  outputFileName as string) as Boolean	
  Dim returnVal as boolean = true
  if outputType.ToUpper() = "FILE" AND outputFileName.Substring(0, 2) <> "C:"
    returnVal = false
  End If
  return returnVal 
End Function

See also


© Stonefield Software Inc., 2023 • Updated: 06/06/16
Comment or report problem with topic