This script is called before the selected report is run. You can use this to change the report or output properties.

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
Any value (Stonefield Query ignores the return value).

Example
Here's an example that logs when a report is run.

Visual FoxPro

lparameters toApplication as SQApplication, tcReportFileName, ;
  tcOutputType, tcOutputFileName
strtofile(tcReportFileName + ' started by ' + SQApplication.Users.UserName, 'reportlog.txt')
return

VBScript

function Main(Application, ReportFileName, OutputType, _
  OutputFileName)
dim fso, ts
const ForWriting = 2
set fso = CreateObject("Scripting. FileSystemObject")
set ts = fso.OpenTextFile("reportlog.txt", ForWriting, True)
ts.WriteLine(ReportFileName + " started by " + Application.Users.UserName)
ts.Close
end function

JavaScript

function Main(Application, ReportFileName, OutputType, 
  OutputFileName) {
var fso, ts ;
var ForWriting= 2 ;
fso = new ActiveXObject("Scripting.FileSystemObject") ;
ts = fso.OpenTextFile("reportlog.txt", ForWriting, true) ;
ts.WriteLine(ReportFileName + " started by " + Application.Users.UserName) ;
ts.Close ;
}

See Also
ReportEngine.AfterReportPrepared | ReportEngine.AfterRunReport | Scripts