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
Simeon Kirov Author on
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