1. Home
  2. /
  3. Docs
  4. /
  5. Articles Report Writer
  6. /
  7. Report Functions
  8. /
  9. Report Functions

Report Functions

Preview Script Functions

These functions are available in PascalScript and allow you to open reports, run reports directly, and open web pages from within a dialog or report script.

OpenReport

procedure OpenReport(ReportFileName, Param: String);

Opens a report in a new preview window. The report runs normally and the user can interact with the preview, print, or export from it.

Parameters

ParameterTypeDescription
ReportFileNameStringThe full path and filename of the report (.fr3) to open.
ParamStringOptional. A pipe-separated list of name=value pairs to pass as report variables. Pass an empty string if not required.

Examples

Open a report with no parameters:

OpenReport('C:\Reports\CustomerList.fr3', '');

Open a report and pass a single parameter:

OpenReport('C:\Reports\CustomerStatement.fr3', 'CustNo=1234');

Open a report and pass multiple parameters:

OpenReport('C:\Reports\SalesReport.fr3', 'StartDate=2026-01-01|EndDate=2026-03-31|SalesRep=Smith');

RunReport

procedure RunReport(ReportFileName, Param: String;RunType:TfrxDirectRunType);

Executes a report directly with no preview window. The report must be configured as either Direct Print or Direct Email. If the report is any other kind it will exit without doing anything.

  • SendAsPrint — the report is sent straight to the printer configured with the reports DirectPrinterName.
  • SendAsAttachment — the report is exported and emailed to the address configured in the report settings. The DefaultEmailAddress and DefaultEmailSubject must be set in the report or the send will be skipped. Report is sent as an emil attachment.
  • SendAsEmailBody — the report is exported and emailed to the address configured in the report settings. The DefaultEmailAddress and DefaultEmailSubject must be set in the report or the send will be skipped. Report is sent in the Email Body.

Parameters

ParameterTypeDescription
ReportFileNameStringThe full path and filename of the report (.fr3) to run.
ParamStringOptional. A pipe-separated list of name=value pairs to pass as report variables. Pass an empty string if not required.
RunTypeTfrxDirectRunTypeSendAsAttachment, SendAsEmailBody, SendAsPrint

Examples

Print a report with no parameters:

RunReport('C:\Reports\DailyOrders.fr3', '',SendAsPrint);

Email a report and pass a customer number:

RunReport('C:\Reports\Invoice.fr3', 'InvoiceNo=10045',SendAsEmailBody);

Print a report with a date range:

RunReport('C:\Reports\SalesSummary.fr3', 'StartDate=2026-01-01|EndDate=2026-01-31',SendAsAttachment);

Passing Parameters

Both OpenReport and RunReport accept parameters using the same format. Parameters are passed as a single string of name=value pairs separated by the pipe character |.

Format

'Name1=Value1|Name2=Value2|Name3=Value3'

Rules

  • The = sign separates the variable name from its value.
  • The | pipe character separates multiple name=value pairs.
  • Variable names must match exactly the variable names defined in the report.
  • String values do not need quotes — Articles handles quoting automatically.
  • Numeric values are passed as-is without quotes.
  • Pass an empty string if no parameters are needed.

Examples

Single string parameter:

'CustName=Acme Industries'

Single numeric parameter:

'CustNo=1234'

Multiple parameters:

'CustNo=1234|StartDate=2026-01-01|EndDate=2026-03-31'

OpenWebBrowser

procedure OpenWebBrowser(URL: String);

Opens the specified URL in the user’s default web browser.

Parameters

ParameterTypeDescription
URLStringThe full URL to open including the protocol, for example https://www.example.com

Examples

Open a website:

OpenWebBrowser('https://www.example.com');

Open a help page based on a variable:

OpenWebBrowser('https://docs.mycompany.com/help/' + HelpTopic);