web stats
Mirth Community - View Single Post - SQL -> XML -> Delimited (CSV)
View Single Post
Old 01-22-2019, 01:13 PM
jbartels jbartels is offline
Mirth Guru
Join Date: Oct 2006
Posts: 729
jbartels is on a distinguished road

I expanded Tonys code to also include a header row:

msg.setName('delimited'); // technically, this line is optional.
for each (var result in msg.result) result.setName('row');

//get the name of each element and add it as a header row
var headerRow = new XML('<row/>');
for each (var element in msg.row[0].children()){
	if (element != null){
		var name = element.name();
		var headerColumn = new XML('<' + name + '>' + name + '</' + name + '>');
This looks clunky but it works.
Jon Bartels

Zen is hiring!!!!
Talented healthcare IT professionals wanted. Engineers to sales to management.
Good benefits, great working environment, genuinely interesting work.
Reply With Quote