DL

Hi

I want to backup my reports from a script, can it be done? I read some post, but I didn't find one to guide what I want to do Hope any one can help

Regards

Diego A.

by Didier Nowak
Posted on Wed, 11/16/2016 - 13:15

Hi,

By using the ScriptAdmin component, you can achieve what you are trying to do, hre a rough example:

var scriptAdminComponent = Context.getComponent("ScriptAdmin") ;

var categories = scriptAdminComponent.getCategories(1, 1033);

    for(var i=0; i<categories.length; i++){

        var categoryId = categories[i].getCategoryID();

        var categoryName = categories[i].getName();

        var scriptsInfosInCategory = scriptAdminComponent.getScriptInfos(1, categoryId,1033);

    for (var j = 0; j < scriptsInfosInCategory.length; j++){

        var zippedData = scriptAdminComponent.exportFile(1, categoryId,scriptsInfosInCategory[j].getID()).getData();

        var filePath = "something.js";

            var javaFile = new java.io.File(filePath);

            Packages.org.apache.commons.io.FileUtils.writeByteArrayToFile(javaFile, zippedData);

    }

}

0
by Diego Labrador Author
Posted on Fri, 11/18/2016 - 13:17

In reply to by dinow

Thanks Didier, I'll check and back to you

Regards

Diego A.

0

Featured achievement

Question Solver
Share your expertise and have your answer accepted as best reply.
Recent Unlocks
  • BZ
  • Profile picture for user TEF_Bernd
  • ПЦ
  • CR
  • BH
  • PacMan

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