onGetReportFilename() (tick_24Enterprise Only)

onGetReportFilename()

This function is called when first setting the report filename of a report page. Report filenames can be overridden by setting $_JOB.report.filenames[page].

NOTE: The event is only called for multiple page reports.

NOTE: Report files that are renamed by this function are not automatically deleted at the next batch run.

By setting the number of reports per page to 1 and using this event, the filenames of the report pages can be set based on the target that each report page contains.

Retrieve the current target with CurrentTarget or CurrentTargetWithRedirect.

Below are the relevant variables:

$ogrf_page - (integer) the report page number; read-only

Example 1:

function onGetReportFilename() {
 ProgressMessage('onGetReportFilename(): page is '+$ogrf_page+', CurrentTarget is : '+CurrentTarget);
 if $ogrf_page==1 {
  $_JOB.report.filenames[1]='renametest'+date('yyyyMMdd'); // set only the filename base
 }
}

Example 2:

function onGetReportFilename() {
 $fn=replaceRegEx(CurrentTargetWithRedirect,'[^a-zA-Z0-9]','_');
 $_JOB.report.filenames[$ogrf_page]=$fn;
}