Hi -
I already have a report that pulls the scheduled report results and generates an Excel file on a shared drive:
var reportScheduler = Context.getComponent("ReportScheduler");
var aByteArrayResult = reportScheduler.getDecryptedScheduleResult("scheduledReportGUID", "username", "password", false);
var aSelectedFile = reportScheduler.getZipEntries(aByteArrayResult);
var aByteArrayXLSX = null;
for (var i in aSelectedFile) {
if (aSelectedFile[i].getName().equals("OutputFile.xlsx")) {
aByteArrayXLSX = aSelectedFile[i].getData();
break;
}
}
var outputFile = new java.io.File(filePath + "\\OutputFile.xlsx");
var fop = new java.io.FileOutputStream(outputFile);
if (!outputFile.exists()) {
outputFile.createNewFile();
}
fop.write(aByteArrayXLSX);
fop.flush();
fop.close();
This is working great for a single database, but I need to be able to set this up for multiple databases nightly. Is there a way to get to the scheduled report without needing the GUID? Since the scheduled report GUID is completely different from the report GUID, I need to hard code in the scheduled report GUID within the report.
This creates a problem - if I have to get the scheduled report GUID via the database names, they could change and it could break. And if for some reason the scheduled report gets removed and set up a 2nd time, it will also break.