Hello,
I use a macro to start a report which create a XML file with some values. The report use the values and create a simple xml file.
When I start the debug mode on the report, then everything works. It creates a xml file on following path:
C:\Users\****\Documents\ARIS 9.8
But when I start the report over the macro with "Report.execute(...)" -> then i can´t find any xml file.
But "xmlOutput.WriteReport()" return true, so the document has been successfully loaded...
Thanks!
__________________________________
//Macro code:
selection = Context.getSelectedDatabases();
(...)
var reportInfo = Report.createExecInfo("dc912610-b53f-11dd-59b4-b1c29b9461d4", selection, Context.getSelectedLanguage());
reportInfo.setProperty("OBJEKT_NAME", oName);
reportInfo.setProperty("OBJEKT_TYPE",oObjectType);
var result = Report.execute(reportInfo, Context.getShowResult());
//Report Code:
var oObjName = Context.getProperty("OBJEKT_NAME");
var oObjType = Context.getProperty("OBJEKT_TYPE");
var documentName = oObjName +".xml"
var xmlOutput = Context.createXMLOutputObject(documentName, "Root");
var xmlItem = xmlOutput.addElement(xmlOutput.getRootElement(), "ObjDef");
xmlItem.setAttribute("Name", oObjName);
xmlItem.setAttribute("TypeNum", oObjType);
xmlOutput.WriteReport();
I found my problem...
You have to set the selected format and the file.
so your code in the report have to be like this:
//Report
Context.setSelectedFormat(Constants.OutputXML);
var oObjName = Context.getProperty("OBJEKT_NAME");
var oObjType = Context.getProperty("OBJEKT_TYPE");
var documentName = oObjName +".xml"
Context.setSelectedFile(documentName)
var xmlOutput = Context.createXMLOutputObject(documentName, "Root");
var xmlItem = xmlOutput.addElement(xmlOutput.getRootElement(), "ObjDef");
xmlItem.setAttribute("Name", oObjName);
xmlItem.setAttribute("TypeNum", oObjType);
xmlOutput.WriteReport();