web stats
Delete all OBX lines from a specific point - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-16-2017, 12:46 PM
Jaypell22 Jaypell22 is offline
OBX.1 Kenobi
 
Join Date: Jul 2011
Location: Upstate NY
Posts: 33
Jaypell22 is on a distinguished road
Default 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;
}
}
Reply With Quote
  #2  
Old 03-16-2017, 01:44 PM
cbarlow cbarlow is offline
OBX.2 Kenobi
 
Join Date: Sep 2015
Location: Missouri
Posts: 52
cbarlow is on a distinguished road
Default

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++;
}
Reply With Quote
  #3  
Old 03-16-2017, 09:47 PM
jack.downes jack.downes is offline
OBX.2 Kenobi
 
Join Date: Apr 2014
Posts: 59
jack.downes is on a distinguished road
Default

I searched the forums...

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

Tags
delete segments, java, obx

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 05:08 PM.


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