about 1 minute to read

This script is called just before a report is output to a file or emailed. You can use this to change the report or output properties.

Parameters
A reference to the Stonefield Query Application object, the name of the report, the output type ("FILE" or "EMAIL"), the output file name, and a reference to a Report object for the report.

Return Value
True if the report run can continue, False to cancel the run.

Example
Here's an example that encrypts a file being emailed using the indicated password. In the case of a PDF file, the file itself is encrypted; other file types are added to an encrypted ZIP file which is used as the attachment instead of the file.

Visual FoxPro

foxpro
lparameters toApplication as SQApplication, tcReportName, ; tcOutputType, tcOutputFileName, toReport as Report if tcOutputType = 'EMAIL' toReport.EncryptPassword = 'MyPassword' endif return .T.

VBScript

function Main(Application, ReportName, OutputType, _
  OutputFileName, Report)
if OutputType = "EMAIL"
  Report.EncryptPassword = "MyPassword"
end if
Main = true
end function

JavaScript

javascript
function Main(Application, ReportName, OutputType, OutputFileName) { if (OutputType == "EMAIL") Report.EncryptPassword = "MyPassword" ; return true ; }

C#

The method in this script must be named ReportEngine_BeforeCreateFile.

csharp
public static bool ReportEngine_BeforeCreateFile(SFQApplication sfqApplication, string reportName, string outputType, string outputFileName, Report report) { if (OutputType == "EMAIL") Report.EncryptPassword = "MyPassword" ; return true; }

VB.NET

The method in this script must be named ReportEngine_BeforeCreateFile.

public shared function ReportEngine_BeforeCreateFile(sfqApplication as SFQApplication,
  reportName as string, outputType as string, outputFileName as string,
  reportRun as Boolean, report as Report) as Boolean
  if OutputType = "EMAIL"
    Report.EncryptPassword = "MyPassword"
  end if
  Return True
End Function

See also

ReportEngine.AfterCreateFile | ReportEngine.BeforeRunReport | Report Object | Scripts

© Stonefield Software Inc., 2024 • Updated: 01/13/17
Comment or report problem with topic