How to create new file after new session of Batch Jobs ?

Hi guys!

 

I have project called AX PUSH Reports. I have 3 types of reports Daily, Weekly and Monthly.

The requirements is to save the Reports in designated folder that can access by the user and Email the Link/Path of the Shared folder, so that they can view and back track the reports.

 

Now my problem is, When the Batch Jobs Run on the given schedules, the file created last time is overwritten.

 For Example in my Daily Reports:

  • SalesReport_09032017.xls -  date modified Sept. 03, 2017 - date modified Sept. 04, 2017

 

What I want to do is to create new file every Run of Batch Jobs. 

For example:

  • SalesReport_09032017.xls -  date modified Sept. 03, 2017
  • SalesReport_09042017.xls  - date modified Sept. 04, 2017

Please see below controller, this is what i used.

class CDRController_daily extends SrsReportRunController
{

}
public static void main(Args _args)
{
    CDRController_daily         controller = new SrsReportRunController();
    SRSPrintDestinationSettings     settings;
    date today_n = today();

    str date_n = date2Str(today_n, 321, 2, 0, 2, 0, 4);

    #File
    str fileName = strFmt('CDRDailyReport_%1', date_n);
    fileName = System.IO.Path::ChangeExtension(fileName,#xlsx);

  
    // Define report and report design to use
    controller.parmReportName(ssrsReportStr(PSDCDR_daily, CDR));

    // Change print settings as needed

        settings = controller.parmReportContract().parmPrintSettings();
        settings.printMediumType(SRSPrintMediumType::File);
        settings.fileFormat(SRSReportFileFormat::Excel);
        settings.overwriteFile(false);
        settings.fileName(@'\\192.168.3.123\ax push report\CDR\Daily\' + fileName);

    // Execute the report
    controller.startOperation();
}

 

Thank you in advance.

Parents Reply Children
No Data
Related
Recommended