Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   Delete all OBX lines from a specific point (http://www.mirthcorp.com/community/forums/showthread.php?t=217027)

Jaypell22 03-16-2017 12:46 PM

Delete all OBX lines from a specific point
 
Hi All. Hoping this is quick and easy. I have the below code which deletes 6 lines down from a certain starting point. I need to change it to delete ALL lines from that starting point which in this case is the text "PREVIOUS REPORT:" Thanks for the help!

for (var i = 0; i <= msg.elements('OBX').length()-1; i++) {
msg.OBX[i]['OBX.1']['OBX.1.1'] = i+1;
if (msg.OBX[i]['OBX.5']['OBX.5.1'].toString() == "PREVIOUS REPORT:") {
delete msg.OBX[i];
delete msg.OBX[i];
delete msg.OBX[i];
delete msg.OBX[i];
delete msg.OBX[i];
delete msg.OBX[i];
i-=6;
}
}

cbarlow 03-16-2017 01:44 PM

var i = 0;
var found = 0;
for each(wOBX in msg..OBX) {
if(found != 0) {
delete msg.OBX[found];
}
if (msg.OBX[i]['OBX.5']['OBX.5.1'].toString() == "PREVIOUS REPORT:") {
found = i + 1;
}
i++;
}

jack.downes 03-16-2017 09:47 PM

I searched the forums...

http://www.mirthcorp.com/community/f...d.php?t=214728


All times are GMT -8. The time now is 10:22 AM.

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