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
        // Get file name 
        var xmlFile = models[j].Name(nLocale)+".xml";
        // Get XML writer and write the report
        var xmlWriter = Context.createXMLOutputObject(xmlFile, doc);


However invoking 


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!


Tags: ARIS Report Scripting