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

by Diego Labrador Author
Posted on Thu, 02/04/2016 - 14:25

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

0
by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Thu, 02/04/2016 - 14:27

Thanks for the information !

0
by Manny D.
Posted on Fri, 02/12/2016 - 20:43

Hello!

i followed your guide, but i got an error Message:

CREATOR is not defined



Can someone help me fixing that?



Regards

File attachments
0
by Diego Labrador Author
Posted on Mon, 02/15/2016 - 16:05

In reply to by MannyD

Hello Manfred

Can you post or send the code that gives the error? Also the Aris version?

Regards

0
by Manny D.
Posted on Mon, 02/22/2016 - 10:08

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);
        }
    }
}

 

0
by Manny D.
Posted on Mon, 02/22/2016 - 10:09

In reply to by MannyD

Sorry, i tried to fix the layout from the text... didnt work :-(

0
by Diego Labrador Author
Posted on Mon, 02/22/2016 - 13:29

Hi Manfred

I have to ask, did you have a scheduled reports? I mean, you created the report and add to the folder "Scheduled report" inside your DB?

Let me know. You can write me and email

Regards

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock