The report to print. The report must include a fully qualified path to the report location. If specifying a SSRS report, use the format reportName.ssrs.a5rpt. See examples below.
Type of file to create. Can be one of the following values:
Creates a PDF file.
Exports report as an Excel file.
Creates an HTML report.
Creates an RTF file.
Creates a text file.
Filter expression to apply to report. Specify an empty string for no filter. Not supported for SSRS reports.
Order expression to apply to report detail. Specify an empty string for no order. Not supported for SSRS reports.
Name of file to create.
A pointer to the global variables. Pass in global_variables() if you do not need to define your own global variables. Not supported for SSRS reports. See explanation below for more information.
The a5w_report_saveas() method prints LayoutName to file in PDF, HTML, RTF, or TXT formats. If no format is specified, the PDF format is used. If a report needs to get access to global variables defined in a .a5w page, you must call this function, and not Report.SaveAs()
The a5w_report_saveas function generates a Report from the Application Server.
Reports can be defined in the workspace library or as individual report files on the Web Projects Control Panel. The LayoutName must include a fully qualified path to the location of the report file. Depending on where the report is located, you can specify the path as follows:
- Workspace Library (*.alb)
- Project Report (*.a5rpt)
The example below shows how to use the [PathAlias.ADB_Path] placeholder when specifying the location of the workspace library.
'Print a report stored in the workspace library: a5w_report_saveAs("myReport@[PathAlias.ADB_Path]\MyWorkspace.alb","PDF","","","myReport.pdf",global_variables())
The next example shows how to use the context.request.applicationRoot property when specifying the location of a Project Report (a report saved as a *.a5rpt file.)
'Print a Project Report: a5w_report_saveAs(a5_removeTrailingBackslash(context.request.applicationRoot) + chr(92) + "myReport.a5rpt","PDF","","","myReport.pdf",global_variables())
In a desktop application, global variables are accessible throughout the application. Passing a pointer to the global variables is not necessary.
In a web application, global variables are variables defined on on the .a5w page and exist for the duration of the page. They are not accessible to other .a5w pages. You can use the global_variables() method to create a pointer to the global variables defined in an .a5w page
dim globalvars as p globalvars = global_variables() globalvars.userName = "John Smith"
If you have global variables that are used by the report, you must create and pass the global variable to the a5w_report_saveas method in a web application.
dim globalvars as p globalvars = global_variables() globalvars.myglobal1 = "foo" dim layout_name as c layout_name = a5_removeTrailingBackslash(context.request.applicationRoot) + chr(92) + "customerList.a5rpt" a5w_report_saveAs(layout_name,"PDF","","","c:\data\custlist.pdf",globalvars)
Reports created using SQL Server Reporting Services can be generated from Xbasic using the a5w_report_saveAs() function. If the SSRS report has any parameters, they can be specified using the Arguments parameter. For example:
dim reportName as c reportName = "customersbystate.ssrs.a5rpt" dim args as sql::Arguments args.add("whatcountry","UK") dim filename as c filename = a5w_report_saveAs(reportname,"pdf","","","c:\pdf\report1.pdf",null_value(),null_value(),args) sys_open( filename)
Not all parameters are supported for SSRS reports. Specifically, you cannot use the filter, order, global variables or print options parameters.