web stats
Mirth Community - View Single Post - Combine Two Z Segments Into One
View Single Post
  #2  
Old 09-04-2013, 11:08 PM
glenn71 glenn71 is offline
OBX.3 Kenobi
 
Join Date: Nov 2010
Location: Sydney Australia
Posts: 129
glenn71 is on a distinguished road
Default

I am no expert... but possibly something like this?

Code:
var z1 = '';
var z2 = '';
var z3 = '';
var z4 = '';
var z5 = '';
var i = -1;

for each (z in msg.ZP2)
{
    if (z1 != z['ZP2.1'].toString() || z2 != z['ZP2.2'].toString() || 
        z3 != z['ZP2.3'].toString() || z4 != z['ZP2.4'].toString() || 
        z5 != z['ZP2.5'].toString() ) 
    {
        z1 = z['ZP2.1'].toString();
        z2 = z['ZP2.2'].toString();
        z3 = z['ZP2.3'].toString();
        z4 = z['ZP2.4'].toString();
        z5 = z['ZP2.5'].toString();
        i++;
    } else {
       msg['ZP2'][i]['ZP2.14'] = z['ZP2.14'].toString();
       delete z;
    }
     
}

Last edited by glenn71; 09-04-2013 at 11:27 PM.
Reply With Quote