web stats
Delete segment xml - Page 2 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #11  
Old 12-02-2019, 11:40 AM
kirbykn2's Avatar
kirbykn2 kirbykn2 is offline
Mirth Guru
 
Join Date: Sep 2014
Location: Michigan
Posts: 586
kirbykn2 is on a distinguished road
Default

Can you post the resolution?
__________________
Best,

Kirby

Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

Appliance Version 3.11.4
Mirth Connect Version 3.8.0
Java Version 1.6.0_45-b06
Java (64 bit) Version 1.6.0_45-b06
Java 7 (64 bit) Version 1.7.0_151-b15
Java 8 (64 bit) Version 1.8.0_181-b13
PostgreSQL Version 9.6.8
Reply With Quote
  #12  
Old 12-03-2019, 03:01 AM
mberges mberges is offline
OBX.1 Kenobi
 
Join Date: Jan 2018
Posts: 44
mberges is on a distinguished road
Default

for (var i = 0; i < getArrayOrXmlLength(msg['OUL_R24.ORDER']['OUL_R24.SPECIMEN']); i++) {

delete msg['OUL_R24.ORDER'][i]['OUL_R24.SPECIMEN']['SPM'];

}
Reply With Quote
  #13  
Old 12-03-2019, 10:45 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,028
agermano is on a distinguished road
Default

The other answers did work for your example in the first post, but you weren't giving us the whole picture. Something like this should also work:

Code:
for each (var spm in msg['OUL_R24.ORDER']['OUL_R24.SPECIMEN']['SPM']) {
    delete spm[0];
}
You've actually got your index in the wrong place in your solution. It might work some of the time, but it would likely break if there were ever more than one OUL_R24.SPECIMEN per OUL_R24.ORDER.

Based on your loop, it should be:
Code:
delete msg['OUL_R24.ORDER']['OUL_R24.SPECIMEN'][i]['SPM'];
Reply With Quote
Reply

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 11:35 PM.


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