Setting up QAD Reporting Framework Service
Scheduled Batch Mode
You can automate the process of generating routine reports by scheduling them to automatically run at specified times or intervals and have the reports sent to a specified destination, such as a printer or the document service on the report server.
To schedule reports to run at a specified time or interval, on the report server, you create a Windows scheduled task for a batch and group the reports in the batch.
The Windows Task Scheduler should be configured to launch the Report Batch Processor, which is a non-GUI instance of the QAD .NET UI launched from the command line, for a specific batch as scheduled and runs all the scheduled reports grouped in the batch. If already set up, the report outputs are sent to the QAD .NET UI document service and/or server-side printer as configured.
Multiple report servers can be set up for increased throughput and failover. The different servers can be configured to process different batches, or can even jointly process reports in the same batch. The Report Batch Processor coordinates the processing of scheduled reports with different priorities in the correct sequence across multiple report servers.
Scheduled reports have the following additional features compared to reports run in Report Viewer:
• The output file (PDF/Excel) of a scheduled report can be uploaded to the document service so that the user can view it in the QAD .NET UI later.
• E-mail notifications, including SMTP mails and inbox messages embedded in the QAD .NET UI. You should specify e-mail addresses and the inbox user IDs when creating scheduled reports. When a report link is included in the e-mail notification to a scheduled report, the link is a direct link to the report file on the server. This direct link launches the report in a browser. However, for QAD .NET UI inbox messages, the link is a QAD Shell URL (http://qadsh) link that launches the report in the QAD .NET UI.
• Server-side printing. You can specify the printer that the report server uses to print the output file.
• Scheduled reports are maintained by the administrator from the maintenance program. The administrator controls the running sequence of scheduled reports by modifying their priorities.
Set Up a Scheduled Batch
1 Create a batch in Batch ID Maintenance (36.14.1).
2 On the report server, create a scheduled task for the batch through Windows Task Scheduler.
a Create a parameter file to contain command line parameters with fixed values. Use the following params.pf file as an example:
-silent
-config-name:test
-user:mfg
-password:(blank)
-workspace:Domain1.1000
-report-batch:batch1
-enable:qad.plugin.services
-enable:qad.plugin.reports
-enable:qad.plugin.reportserver
-enable:qad.plugin.financials
-report-mode:batch
Note: You must specify -enable:qad.plugin.financials if you are using QAD Enterprise Applications — Enterprise Edition. You must not specify -enable:qad.plugin.financials if you are using QAD Enterprise Applications — Standard Edition.
You need to set your own desired values for these parameters:
• -config-name: The name of the configuration that the report server should log on to. This is the same as the value chosen by an end user from the drop-down list in the login screen of the QAD .NET UI application when run in GUI mode.
• -user: User ID for logging on to the QAD .NET UI system
• -password: Password for logging on to the QAD .NET UI system
• -workspace: The workspace key of the desired workspace to run scheduled reports in. This is important, since any batch queue is specified by a unique combination of domain and batch ID, and the domain that the report server will use is the domain associated with the specified workspace key.
• -report-batch: The batch ID that will be used in conjunction with the domain associated with the specified workspace key to determine the batch of reports to run.
b In the launching script of the report server process, use the parameter file in place of the parameters:
QAD.Client.exe -param.url:file:///c:/params.pf
If the parameter file is referenced by a URL, you can choose to place the file on the local machine or a report server.
QAD.Client.exe -param.url:http://localhost/rpt/params.pf
Note: The language that translations will be done is in the language of the user who scheduled the report, regardless of the server user’s language.
Setting Up E-Mail Notifications
To set up e-mail notifications, add the following entries to client-session.xml on the home server:
<Configuration>
...
<!-- SMTP server host name -->
<Smtp.Host>SMTPHostname</Smtp.Host>
<!-- SMTP port name -->
<Smtp.Port>SMTPPortNumber</Smtp.Port>
<!-- SMTP from email address -->
<Smtp.From>E-Mail</Smtp.From>
<!-- SMTP username -->
<Smtp.Username>SMTPUsername</Smtp.Username>
<!-- SMTP password -->
<Smtp.Password>SMTPassword</Smtp.Password>
<!-- SMTP use SSL -->
<Smtp.UseSSL>false</Smtp.UseSSL>
</Configuration>
Use the following settings as a reference:
<Smtp.Host>smtp.qad.com</Smtp.Host>
<Smtp.Port>25</Smtp.Port>
<Smtp.Username>admin</Smtp.Username>
<Smtp.Password>123</Smtp.Password>
<Smtp.UseSSL>false</Smtp.UseSSL>
Modifying the Scheduled Report e-mail Template
When a scheduled report is run by the report server, the system sends an e-mail notification if any e-mail addresses were specified when the report was scheduled. The email can optionally contain the report output file as an attachment if this was specified at the time of scheduling.
The system uses an e-mail template to determine the subject and body of the report notification e‑mails. This template is stored in a special file called report-email-template.txt on the QAD .NET UI home server. The file can be modified if administrators want to change the default content.
Note: The e-mail template can be overriden for a specific scheduling of a report by setting the sys_email_template report value to contain the desired template string. This is possible when scheduling a report programmatically using the Scheduled Report API.
The file is located on the home server as follows:
.../webapps/qadhome/configurations/<configuration-name>/storage/reports/
report-email-template.txt
The default content of report-email-template.txt is as follows:
[SUBJECT]
Scheduled Report Completed: {$RRO_DESC}
[BODY]
A scheduled report from QAD Enterprise Applications has completed:
Report: {$RRO_DESC} ({$RRO_CODE})
Description: {$SR_DESC}
Link to Report: {$REPORT_FILE_LINK}
The structure of the e-mail template consists of two parts:
• A [SUBJECT] tag followed by the subject content on the next line, which is used as the subject of the email notification.
• A [BODY] tag followed by any number of lines of text, which is used for the body of the e‑mail.
Both the subject and body text can contain both literal text portions as well as dynamic variable references. The dynamic variables get resolved at run-time and are specified using the same syntax as for dynamic variables in scheduled report file routing. In addition to the variables allowed for file routing, there is another variable used only for e-mail templates: $REPORT_FILE_LINK, which gets resolved at run-time to a URL string that points to the report output file on the home server (if file linking or attaching was specified at the time of scheduling).
Setting Up a Printer
Note: Starting with the QAD .NET UI 2.9.2 (Enterprise Applications 2010.1 EE) release, printer setup for scheduled reports has changed. The Printer Setup Maintenance program is no longer used for the Reporting Framework. Instead, use the following steps to set up a printer for scheduled reports. If you are upgrading from an older version, any scheduled reports that refer to the previous printer types will still execute properly. However, the following steps must still be done to allow printers to be defined for new scheduled reports.
1 Set up a physical printer on the report server. From the Windows Start menu, select Control Panel|Printers and Faxes|Add a Printer to add a printer.
2 In the client session configuration file (client-session.xml), located in the TomcatInstallDir/webapps/qadhome/configurations/SysEnvName/ directory, set up printers available for scheduled reports as follows:
<ReportServer>
<Printer>
<UNCPath>\\machineA\printerA</UNCPath>
<Description>Description of printer (optional)</Description>
</Printer>
<Printer>
<UNCPath>\\machineB\printerB</UNCPath>
<Description></Description>
</Printer>
</ReportServer>
Setting up a Scheduled Report Default Printer
You can choose the default printer for the Schedule Report screen from Tools|Options. The list of printers displayed in the Options window is the same as the list in the Schedule Report screen—the list specified in the client-session.xml file. If no default is chosen, the Windows default printer is used as the default if the Windows default printer is one of the printers specified in the client-session.xml file.
The format to specify the default printer in client-session.xml is to set default=”true” in the <Printer> tag, as shown in the following example:
<ReportServer>
<Printer default="true">
<UNCPath>\\server_name\printer_name</UNCPath>
<Description>My Default Printer</Description>
</Printer>
...
</ReportServer>
Configuring Output File Naming and Location
Administrators can now configure flexible, dynamic routing rules to control report output file names and path. The rules can be set up with defaults to handle most general types of reports, as well as specific alternatives based on the report type and layout. For example, a certain type of report containing sensitive data could be funneled to a special folder that has Web access disallowed.
In addition to configuring such report routing rules on a system-wide basis, administrators can also override the file name and path rules for any specific scheduling of a report. For example, for a certain report that gets run every month in batch, a special naming convention and folder path can be assigned for that per-month batch run of that report, overriding any general rules that may have been configured for the same report type.
In client-session.xml, you specify the file routing in the <ReportServer> section.
The <ReportOutputFileRoute> element’s reportCode and layout attributes specify the report codes and layouts to which the file routing is applied. If reportCode and layout are both blank, the specified file routing is applied to all reports and layouts. If additional <ReportOutputFileRoute> entries are added that specify report codes and layouts, these entries override the general entry for reports matching the more specific entries.
The rules that govern output file naming and directory path are specified in two child elements of <ReportOutputFileRoute>:
• <OutputFilePath> specifies the directory path for the file, relative to the reports directory on the home server document storage area (qadhome/configurations/<config_name>/
storage/reports/).
• <OutputFileName> specifies the file name.
Both of the above entries allow dynamic variable substitutions, which get resolved at run-time. The syntax {$variable_name} is used, where variable_name includes the following:
• RRO_CODE — specifies the report code (for example, QAD_DaybookSetReport) as defined in Report Resource Maintenance.
• RRO_DESC — the description of the report as defined in Report Resource Maintenance.
• SR_ID — the scheduled report identifier, which gets assigned whenever a report gets scheduled.
• SR_DESC — the scheduled report description.
• DATE_TIME — shorthand for the DATE_TIME_yyyyMMddhhmmssffffff dynamic variable.
• USER_ID — the user ID of the user who scheduled the report.
Any report setting can also be used as a variable name, in which case the run-time value of that setting is dynamically substituted. If no setting is found that matches the variable name, a blank is substituted.
REPORT_FILE_LINK — (only available for the e-mail template)
Additionally, there is a special dynamic variable that can be used with the output file name entry that resolves to a date-time stamp. This is very important to use for file naming, since a file name that matches one that already exists in the same directory from a previous report run results in a file overwrite. The format of this date-time variable is:
DATE_TIME_<format_specifier>
where <format_specifier> is a .NET date-time format string. For example,
DATE_TIME_yyyyMMddhhmmssffffff
will specify the date-time including year, month, day, hour, minutes, seconds, and fractions of a second to six digits. (It is important to include the fractions of a second portion to prevent file name conflicts in cases where multiple report servers are running.)
An example output file name is: 20120209101213083857.pdf.
You can specify DATE_TIME without a format specifier. In this case, it defaults to the yyyyMMddhhmmssffffff format.
Both file path and file name specifiers can mix any combination of literal text and dynamic variables. For example,
<OutputFileName>daybook-{$DATE_TIME_yyyy-MM-dd-hhmmss-ffffff}</OutputFileName>
will create output files whose names always start with daybook- followed by a dynamic time stamp.
The following example, which includes three <ReportOutputFileRoute> entries, illustrates how the routing rules can be applied:
<ReportServer>
...
<ReportOutputFileRoute reportCode="" layout="">
<OutputFilePath>new-results/{$SYS_DOMAIN}/{$USER_ID}/{$RRO_CODE}/</OutputFilePath>
<OutputFileName>{$DATE_TIME_yyyyMMddhhmmssffffff}</OutputFileName>
</ReportOutputFileRoute>
<ReportOutputFileRoute reportCode="QAD_DaybookSetReport" layout="">
<OutputFilePath>new-results/daybook</OutputFilePath>
<OutputFileName>daybook-{$DATE_TIME_yyyy-MM-dd-hhmmss-ffffff}</OutputFileName>
</ReportOutputFileRoute>
<ReportOutputFileRoute reportCode="QAD_DaybookSetReport" layout="layout1">
<OutputFilePath>new-results/daybook-special</OutputFilePath>
<OutputFileName>daybook-special-{$DATE_TIME}</OutputFileName>
</ReportOutputFileRoute>
...
</ReportServer>
In the above example, the first entry’s routing rules will be applied to all reports other than QAD_DaybookSetReport. The second entry’s routing rules will be used for QAD_DaybookSetReport, except when the layout is layout1, in which case the third entry’s rules will be applied.
Note: Administrators can override the above file routing rules for a particular scheduled report if desired. When scheduling from the Schedule Report form in the QAD .NET UI, custom file name and file path strings can be entered. These fields are only exposed to users belonging to the rptAdmin role.