jemt22
September 6, 2017, 12:16pm
21
Here is my code now…
public static void main(Args _args)
{
CDRController_daily controller;
;
controller = new SrsReportRunController();
controller.parmArgs(_args);
CDRController_daily::run(controller);
// Define report and report design to use
}
public static void run(CDRController_daily controller)
{
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);
controller.parmReportName(ssrsReportStr(PSDCDR_daily, CDR));
settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::File);
settings.fileFormat(SRSReportFileFormat::Excel);
settings.overwriteFile(true);
settings.fileName(@'\\192.168.3.123\ax push report\CDR\Daily\' + filename);
controller.startOperation();
}
Am i correct?
kranthi
September 6, 2017, 12:49pm
22
Remove the parameter for run method and declare a variable for controller
CDRController_daily controller = new SrsReportRunController();
remove the below call and replace it with super()
controller.startOperation();
Place all your code in run method in if (this.isInBatch()) condition except the super();
Keep your main method as original without any changes.
jemt22
September 6, 2017, 12:59pm
23
public void run()
{
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);
controller.parmReportName(ssrsReportStr(PSDCDR_daily, CDR));
settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::File);
settings.fileFormat(SRSReportFileFormat::Excel);
settings.overwriteFile(true);
settings.fileName(@'\\192.168.3.123\ax push report\CDR\Daily\' + filename);
super();
}
public static void main(Args _args)
{
}
Like this Kranthi ?
kranthi
September 6, 2017, 1:07pm
24
public void run()
{
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);
if (this.isInBatch())
{
fileName = System.IO.Path::ChangeExtension(fileName,#xlsx );
controller.parmReportName(ssrsReportStr(PSDCDR_daily, CDR));
settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::File);
settings.fileFormat(SRSReportFileFormat::Excel);
settings.overwriteFile(true);
settings.fileName(@’\192.168.3.123\ax push report\CDR\Daily’ + filename);
}
super();
}
main method - keep it like what you done in the first time. Both methods will have the code to generate file name.
So that it will work for both the cases, 1. in batch 2. non batch mode.
If this works you can refactor the code later.
jemt22
September 6, 2017, 1:50pm
25
Thank you Kranthi.
i change my code in run exactly the same in the code above.
and here is my main method … as is…
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);
controller.parmReportName(ssrsReportStr(PSDCDR_daily, CDR));
settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::File);
settings.fileFormat(SRSReportFileFormat::Excel);
settings.overwriteFile(true);
settings.fileName(@'\\192.168.3.123\ax push report\CDR\Daily\' + filename);
controller.startOperation();
}
i will try this … i will give you feed back
jemt22
September 7, 2017, 1:56am
26
Hi Kranti,
Same same issue…
the file created yesterday is overwrite again.
jemt22
September 7, 2017, 6:22am
27
The 1st filename or file create is always used and overwrite the records…
jemt22
September 7, 2017, 7:53am
28
i searched in the internet to find similar in my case.
and I think my case is unique…
jemt22
September 7, 2017, 8:40am
30
Okay, i think need to find other way…
Thank you guys…
Special thank to Kranthi…