Back to the groovy way to create a .csv file.
In the end of the Orchestration, I went to Manipulate Output and added the following code:
Code:
def json = new JsonSlurper().parseText(jsonOut)
// Extract the "rowset" array
def rowset = json.TEST_Export_F0101.rowset
def filePath = "\\\\SERVER\\Users\\Public\\Documents\\EDI\\F0101.csv"
// The path definitely exists, checked and double-checked; everyone in the network should have access to it
// Create the CSV file
def newFile = new File(filePath)
newFile.createNewFile()
newFile.withWriter { writer ->
// Write the header
writer.writeLine(rowset[0].keySet().join(','))
// Write the rows
rowset.each { row ->
writer.writeLine(row.values().join(',')) }
}
orchestrator produces no error running this, but I didn't find the file where I expected it to be
I tried to read back from the file I've just created, so I added this after writing all the content to my file:
Code:
String fileContents = new File(filePath).text;
Peeked into the fileContents value, and it's correct! fileConents is what I read back from the file, and it's what I expect the file content to be.
So the file did get created somewhere, but definitely not where I expected it, namely not here:
\\SERVER\Users\Public\Documents\EDI\
I played a bit with paths, for example, tried local paths, for example:
C:\temp\F0101.csv
And got the same result, no errors, file got created somewhere I don't know where, but not in my C:\temp
So my questions:
Where are Orchestrations actually run? Where can I try and find the file I created (if it was created, but taking into account I was able to read back from it it was)? How do I direct it to a shared network location?
Thanks in advance! I hope that will help someone else as well in the future