web stats
Mirth Community - View Single Post - EDI X12 837 File Parse Error Mirth Connect 3.0
View Single Post
  #7  
Old 02-12-2015, 04:30 AM
appsbyaaron's Avatar
appsbyaaron appsbyaaron is offline
Mirth Guru
 
Join Date: Nov 2011
Location: Florida, USA
Posts: 377
appsbyaaron is on a distinguished road
Default

This will create an XML record for each whole 837 message. For my project I am reading many messages in a file.

var claims = <claims></claims>;
var claim = <claim></claim>;
var first_ISA = msg['ISA'][0].childIndex();

for(i=first_ISA; i<msg.children().length(); i++){

if(i!=first_ISA && msg.child(i).name().toString() == "ISA")
{
//then you have a new claim
claims.appendChild(claim);
claim = <claim></claim>;
}

claim.appendChild(msg.child(i));
}

claims.appendChild(claim);
channelMap.put("claims", claims);
Reply With Quote