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.

Parameters
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.

Example
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.
endif
return llReturn

VBScript

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

JavaScript

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

C#

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;
}

VB.NET

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

Scripts