web stats
Mirth Community - View Single Post - Combining OBX lines into one AND inserting 80 character limit ~ tilde
View Single Post
  #1  
Old 10-05-2013, 09:49 AM
Jaypell22 Jaypell22 is offline
OBX.1 Kenobi
 
Join Date: Jul 2011
Location: Upstate NY
Posts: 33
Jaypell22 is on a distinguished road
Default Combining OBX lines into one AND inserting 80 character limit ~ tilde

Version 2.2.1.5861.
I am currently using the below code to create one OBX line from Multiple OBX lines. This has been working great however I now have to ensure there is a ~ no more than 80 characters apart within this one line as this is a limitation by the vendor's engine I am sending ORU messages to and is getting rejected.

I did try to first limit each OBX line to 80 characters but it then truncated an lost the rest of the line instead of inserting it into a new one. I think this can be done 2 ways. Before and after this code (who knows maybe in the middle of it!)

So in short.... I need to insert a ~ 80 characters or less apart but not falling in the middle of a word splitting it up in addition to the code I already have in place that combines all OBX.5 data.

Thanks for any help - Jay

Code I am using:

var newOBX = <OBX/>;
newOBX['OBX.1']['OBX.1.1'] = '1';
newOBX['OBX.2']['OBX.2.1'] = 'FT';
newOBX['OBX.5'] = '';
for each (seg in msg.children())
if (seg.name().toString() == 'OBX')
for each (obx5 in seg['OBX.5'])
newOBX['OBX.5'] = newOBX['OBX.5'].toString() ? newOBX['OBX.5']+obx5 : obx5;
newOBX['OBX.14']['OBX.14.1'] = msg['OBR']['OBR.8']['OBR.8.1'].toString();
newOBX['OBX.16']['OBX.16.1'] = msg['OBR']['OBR.32']['OBR.32.1'];
newOBX['OBX.16']['OBX.16.2'] = msg['OBR']['OBR.32']['OBR.32.2'];
newOBX['OBX.16']['OBX.16.3'] = msg['OBR']['OBR.32']['OBR.32.3'];
msg.OBX = newOBX;

Last edited by Jaypell22; 10-05-2013 at 09:52 AM.
Reply With Quote