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

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

Parameters
A reference to the Stonefield Query Application object, the name of the report, the output type ("PREVIEW," "PRINTER," "FILE," or "EMAIL"), the output file name (blank unless the output type is "FILE"), and a Boolean value indicating whether the report ran successfully or not.

Return Value
Any value (Stonefield Query ignores the return value).

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

Visual FoxPro

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

VBScript

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

JavaScript

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

C#

The method in this script must be named ReportEngine_AfterRunReport.

public static void ReportEngine_AfterRunReport(SFQApplication sfqApplication, 
  string reportName, string outputType, string outputFileName, bool reportRun)
{	
  StreamWriter writer = new StreamWriter("reportlog.txt");
  writer.WriteLine(reportName + " ran by " + sfqApplication.Users.UserName);
  writer.Close();
}

VB.NET

The method in this script must be named ReportEngine_AfterRunReport.

public shared function ReportEngine_AfterRunReport(sfqApplication as SFQApplication,
  reportName as string, outputType as string, outputFileName as string,
  reportRun as Boolean) as Boolean
  Dim writer as StreamWriter = new StreamWriter("reportlog.txt")
  writer.WriteLine(reportName + " ran by " + sfqApplication.Users.UserName)
  writer.Close()
  Return True
End Function

See also

ReportEngine.BeforeRunReport | Scripts

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