web stats
Transformer to convert aggregate SQL results to an HTML TAble - Mirth Community

Go Back   Mirth Community > Mirth Connect > General Discussion

Thread Tools Display Modes
Old 02-15-2019, 12:16 PM
jbartels jbartels is offline
Mirth Guru
Join Date: Oct 2006
Posts: 727
jbartels is on a distinguished road
Default Transformer to convert aggregate SQL results to an HTML TAble

This was derived from and inspired by the aggregate SQL to CSV converter by TonyG at http://www.mirthcorp.com/community/f...17&postcount=8

Posting this to give back a little.

//derived from Agermano aggregate to CSV converter from http://www.mirthcorp.com/community/forums/showpost.php?p=264817&postcount=8
//Tony Germano is a genius and a very generous person
msg.@border = '1px solid black;';

//get the name of each element and add it as a header row
var headerRow = new XML('<tr/>');
for each (var element in msg.result[0].children()){
	if (element != null){
		var name = element.name();
		var headerColumn = new XML('<th>' + name + '</th>');

//convert the children to tr's and their children to td's
for each (var result in msg.result){
	for each (var element in result.children()){
Jon Bartels

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

Last edited by jbartels; 02-15-2019 at 12:16 PM. Reason: fix url
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 04:32 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation