Hello
I am trying to change the save location of the report file.
On Ariscommunity.com I found a topic "Path to Output File"
(https://www.ariscommunity.com/users/martinmiskovic/2015-07-15-path-output-file).
But in this topic, an Excel file was used, and I need to output an XML file.
It's my code:
function outputFileToFolder( folderName, fileName, oData ) {
var oFile = new java.io.File(folderName+fileName);
var oOS = new java.io.FileOutputStream(oFile);
oOS.write(oData); // Error: nullPointerException, because oData is empty
oOS.close();
}
function main() {
var xmlOutput = Context.createXMLOutputObject(Context.getSelectedFile(), "Root");
//then I fill the file with content using methods "addElement" and "setAttribute"
//at the end I do this:
Context.addOutputFileName ("101.xml");
xmlOutput.WriteReport(); // it's default folder
var oData = Context.getFile("101.xml", Constants.LOCATION_OUTPUT); // <- oData // is null, because file "101.xml" not apeared in default folder
outputFileToFolder( "C://TEMP//output", "Data.xml", oData ); // it's my folder
}But if I run this script without the last two lines,
var oData = Context.getFile("101.xml", Constants.LOCATION_OUTPUT);
outputFileToFolder( "C://TEMP//output", "Data.xml", oData ); then the file "101.xml" appears in the default folder.
Tell me please, how can I set my folder for creation report by script?
Robert Goldenbaum on
Hi,
well perhaps the problem is that the ARIS report creates the output files always on temporary folders on the server and later on, those files are "delivered" to the client pc and the temporary folders (and files) should be deleted.
You could just create an additional output file and use this one:
Context.addOutputFileName(sLogFileName);
This command will add the file names sLogFileName and transfer it to the client pc at the rend of the report.
Regards,
Robert