DL
I created some reports, put in the scheduled reports with Aris Architec Explorer. I want to get the reports result in some folder, specified by me. Can this be done? Or I need to do some work around?
Thanks in advance
Hi all
I just found the way of do this. This is how:
// Obtain the report scheduler var schedule = Context.getComponent("ReportScheduler"); // Get the report // You can do this in a better wat, by variables, but I can prove it yet // XXXX is the report GUID from the schedule report var reporte = schedule.getDecryptedScheduleResult("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",CREATOR,PASSWROD,false); // Resutl var resultado = schedule.getZipEntries(reporte); // I do this cicle because I have a result call temp.txt, I don´t know why, but just skip and work with the next for (var i=0;i<resultado.length;i++){ csv.OutputLn("Resp Nombre "+i+":"+resultado[i].getName(),"Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); if (resultado[i].getName() != "temp.txt"){ try { // Create a file in a PATH, named the report name in this example. var arch = new java.io.File(PATH,resultado[i].getName()); }catch (e){ // This is standar output to the report result, just to check csv.OutputLn("1:"+e.toString(),"Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); } try { // Create the new file arch.createNewFile(); }catch (e4){ csv.OutputLn("5:"+e4.toString(),"Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); } try { // Create the writer var escritor = new java.io.FileOutputStream(arch); }catch (e1){ csv.OutputLn("2:"+e1.toString(),"Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); } try { // wirte the bit array resultado is the report result escritor.write(resultado[i].getData()); }catch (e2){ csv.OutputLn("3:"+e2.toString(),"Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); } try { // Close the file escritor.close(); }catch (e3){ csv.OutputLn("4:"+e3.toString(),"Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); } } }
Hope this help
Regards
Hey!
I use ARIS 9.7
In the meanwhile i fixed that error with "CREATOR is not defined". - now i got another error: "Error running script: Undefined schedule." (line 2) - is there any requirement for this?
Is it possible to get a detailed guide, how to do that and maybe an example how it would look like and what are the requirements?
Maybe you can have a look at Line 6 and 15, if i filled it correct?
Regards
Here is the Code below:
// Obtain the report scheduler var schedule = Context.getComponent("ReportScheduler"); // Get the report // You can do this in a better wat, by variables, but I can prove it yet // XXXX is the report GUID from the schedule report var reporte = schedule.getDecryptedScheduleResult("85bafba0-d179-11e5-1316-34e6d700ed61", "architecteam", "123", false); // Resutl var resultado = schedule.getZipEntries(reporte); // I do this cicle because I have a result call temp.txt, I don´t know why, but just skip and work with the next for (var i=0;i<resultado.length;i++){ csv.OutputLn("Resp Nombre "+i+":"+resultado[i].getName(),"Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); if (resultado[i].getName() != "temp.txt"){ try { // Create a file in a PATH, named the report name in this example. var arch = new java.io.File("D:\Output",resultado[i].getName()); }catch (e){ // This is standar output to the report result, just to check csv.OutputLn("1:"+e.toString(),"Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); } try { // Create the new file arch.createNewFile(); }catch (e4){ csv.OutputLn("5:"+e4.toString(),"Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); } try { // Create the writer var escritor = new java.io.FileOutputStream(arch); }catch (e1){ csv.OutputLn("2:"+e1.toString(),"Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); } try { // wirte the bit array resultado is the report result escritor.write(resultado[i].getData()); }catch (e2){ csv.OutputLn("3:"+e2.toString(),"Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); } try { // Close the file escritor.close(); }catch (e3){ csv.OutputLn("4:"+e3.toString(),"Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); } } }