Hi Guys,
I need some help.
The activity i'm doing is Batch Jobs Report (Recurrence, Destination)
i set schedule in my report with specific time and day and also set the destination file.
but i encountered a problem says: "The file is already exist in path..."
the file is not overwrite, how do i know the date and the records inside.
How can i solve this? Or how programatically change the file name like this "Filename_dateGenerated.xlsx" or may be overwrite the existing file?
Thank you in advance!
You didn't say which part you're struggling with, so I'll assume it's the first one - setting the name via SRSPrintDestinationSettings.fileName(). If you put SRSPrintDestinationSettings.fileName to a search engine, you'll find a plenty of examples. Here is one in my blog.
Hi Martin.
i read the link you've give, i edit it and i have several questions.
SrsReportRunController controller = new SrsReportRunController(); SRSPrintDestinationSettings settings; // Define report and report design to use controller.parmReportName(ssrsReportStr(PurchaseOrderReport, Purchase)); // Use execution mode appropriate to your situation controller.parmExecutionMode(SysOperationExecutionMode::ScheduledBatch); // Suppress report dialog controller.parmShowDialog(false); // Explicitly provide all required parameters //rdpContract.parmReportStateDate(systemDateGet()); //controller.parmReportContract().parmRdpContract(rdpContract); // Change print settings as needed settings = controller.parmReportContract().parmPrintSettings(); settings.printMediumType(SRSPrintMediumType::File); settings.fileFormat(SRSReportFileFormat::Excel); settings.fileName(@'\\share\PurchaseOrder.xlsx'); // Execute the report controller.startOperation();
I did not use a Data Contract, its because i set the range like this..
qbr = SysQuery::findOrCreateRange(query.datasourceTable(tableNum(PurchTable)),fieldNum(PurchTable, CreatedDateTime)); qbr.value(SysQuery::range(dateStartMth(dateStartMth(systemDateGet())-1),dateStartMth(systemDateGet())-1));
Questions:
1. where do i put or how to use ? sorry
2. how to set schedule with this code? because i want to set the every 1st day of the month. controller.parmExecutionMode(SysOperationExecutionMode::ScheduledBatch);
3. And how will the filename would like this, reason is to save all file for validation purposes. PurchaseOrder_June2017.xlsx
PurchaseOrder_July2017.xlsx
i hope you understand what i'm saying. sorry for everything.
thank you for time and effort.
Regards,
Jhon Edmar
Hi Martin, I know now how to use the Controller. Thank you.. i only have one problem, on how to set the filename like the example below.
Ex.
Filename_July2017.xlsx TIA
Hi Kranthi,
here's my code:
PurchaseOrderController controller = new SrsReportRunController(); SRSPrintDestinationSettings settings; #File str fileName = strFmt('PurchaseOrderReport%1%2', mthName(mthOfYr(systemDateGet())), year(systemDateGet())); fileName = System.IO.Path::ChangeExtension(fileName,#xlsx); info(fileName); // Define report and report design to use controller.parmReportName(ssrsReportStr(PurchaseOrderReport, Purchase)); // Use execution mode appropriate to your situation controller.parmExecutionMode(SysOperationExecutionMode::ScheduledBatch); // Suppress report dialog controller.parmShowDialog(false); //Explicitly provide all required parameters //rdpContract.parmReportStateDate(systemDateGet()); //controller.parmReportContract().parmRdpContract(rdpContract); // 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\PSD\' + fileName); // Execute the report controller.startOperation();