SK

Hi all,

I'm making a report which runs on a group and its subgroups hierarchy and models. Each model should be saved in a separate file, residing in a directory reflecting the subgroup, where it is located. For example, if the model is located in Group1\Group2\My Model, then the report should be saved in a file ${user.selected.dir}\Group1\Group2\My Model.xml (${user.selected.dir} is the directory, selected by the user when the report was run).

 

What I managed to dig-out from the documentation is method Context.setSelectedPath(), but it doesn't seem to work. Here is the code:

// Get the current group and all its children
var group = ArisData.getSelectedGroups()[0];
var groups = group.Childs(true);
    
for (var i=0; i<groups.length; i++) {
    // Iterate over group's models
    var models = groups[i].ModelList();
    for (var j=0; j<models.length; j++) {
        // Create the report
        var doc = createXMLDocument(models[j]);
        
        // Get the absolute path of the directory, where the report should be saved.
        // getAbsoluteOutputPath () is a local function which concatenats
        // Context.getSelectedPath() and the group path. The path separators are 
        // converted from '\' to '/'.
        var path = getAbsoluteOutputPath(models[j]);
        
        // Set the output path
        Context.setSelectedPath(path);
        
        // Get file name 
        var xmlFile = models[j].Name(nLocale)+".xml";
        
        // Get XML writer and write the report
        var xmlWriter = Context.createXMLOutputObject(xmlFile, doc);
        xmlWriter.WriteReport();
    }
}

 

However invoking 

Context.setSelectedPath(path);

results in saving all files in ${user.home} directory (e.g. C:\Users\simeon\Documents\BPA11) instead of ${user.selected.dir} without creating any subdirectory structure.

 

Thank you for your help!

Simeon

by Simeon Kirov Author
Posted on Sun, 01/08/2012 - 22:54

Never mind, it seems that it is not possible to create this kind of directory structure on the client computer. So, I tried different approach - I'm generating the files on the server and I'm saving them under Context.getTempPath() directory.

Then I ZIP them into single archive and I get the ZIP at the client with Dialogs.shell(). The ZIP file is opened on the client's computer, but the afterwards the Dialogs.shell() method gives error:

"Script: , line -1"

 

Are there any known issues about Dialogs.shell() method?

 

Simeon

 

0
by Vladimir Bis
Posted on Tue, 01/10/2012 - 07:59

Hi Simeon,

Dialogs.shell() - this code is not in report, this is in macro, isn't it?

Did you get this error "Script: , line -1" when you run macro on group from Explorer? Because usually this error appears in code editor only.

0
by Simeon Kirov Author
Posted on Tue, 01/10/2012 - 09:21

Hi Vladimir and thank you for your response.

Dialogs.shell() code is in the report. The reports API ptovides access to Dialogs, so it is possible to collect additional information, show messages, etc.

 

Yes, I get "Script: , line -1" only in editor, but if I run the report in Explorer the BPA client hangs and has to be restarted forcefully. I posted more detailed article about this in Aris Support Group: http://www.ariscommunity.com/users/skirov/2012-01-09-report-script-bug-dialogsshell

0
by Vladimir Bis
Posted on Tue, 01/10/2012 - 09:58

Did you send this problem to ARIS support?

0
by Vladimir Bis
Posted on Tue, 01/10/2012 - 12:31

Simeon,

you can create this subdirectory structure (as you wrote in article) on server, because reports run on server.

0
by Simeon Kirov Author
Posted on Wed, 01/11/2012 - 12:45

Hi Vladimir,

 

Since we are using Oracle BPA 11g which uses the ARIS engine, I guess we will have to send the problem to Oracle, not to ARIS Support. For now the workaround we figured-out is solving our problems.

Thank you for your cooperation!

Simeon

0
by Edwin Verstraeten
Posted on Tue, 01/17/2012 - 08:24

Hi Simeon,

You could initiate the report from a macro. In the macro you determine which models need to be exported, you create the output dir and run the report for only the selected models in one group. This wil result in output to the wanted directory.

Best regards,

Edwin

0
by Simeon Kirov Author
Posted on Tue, 01/17/2012 - 08:57

Hi Edwin,

Thank you for your suggestion!

Best Regards,

Simeon

0
by Amol Patil
Posted on Mon, 01/23/2012 - 17:42

Hi Simeon,

There are two methods for saving the files to some specific folders on server. I am explaining one of it. You need to find out how to bring those files to client machine. There can be many ways to bring the files on client machine, you can take help of Macros also by setting the return Property from report. Or through any other desktop app.

I am considering that you have JDom Document object, returned by your method

var doc = createXMLDocument(models[j]);

Here after this you can do the following steps

1. Import file "convertertools.js" in script from Script properties.

2. Use the followin code to save it to specific location

var l_XMLOutputter = org.jdom.output.XMLOutputter();
__createDirectory("C:\\Group1\\Group2");
var l_FileOutputStream = java.io.FileOutputStream("C:\\Group1\\Group2\\test.xml");
l_XMLOutputter.output(doc, l_FileOutputStream);
l_FileOutputStream.close();

The other way is to create files using Java File writer, writing simple text files with XML tags in it, if the XMLs you are generating are in the custom format.

Regards,

Amol Patil

0
by Kumar RS
Posted on Wed, 10/14/2015 - 04:45

thanks

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