web stats
Delete seg if .1= - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-22-2011, 08:56 AM
kmickeletto kmickeletto is offline
Mirth Newb
 
Join Date: Jul 2010
Posts: 24
kmickeletto is on a distinguished road
Default Delete seg if .1=

I am still learning, be gentle...

Trying to delete segments that .1 equals 123...
ORC|RE
OBR|123
OBX|123
NTE|123

afterwards should be
ORC|RE

I am trying to use
delete msg..*['123']

Thanks for correcting my syntax... Have searched forum but nothing jumping out...
Reply With Quote
  #2  
Old 03-22-2011, 10:02 AM
AlexToft AlexToft is offline
OBX.3 Kenobi
 
Join Date: Sep 2010
Location: Leeds, UK
Posts: 160
AlexToft is on a distinguished road
Default

Something like this maybe?

Code:
for each (seg in msg.children()) {

	segname = seg.name().toString();

	if (seg[segname + '.1'] == "123") {
                delete msg[segname];
	};

};
Not tested it, but it pretty much works in my head. Make sure "Parse Repetitions" is selected in transformer data type options.
Reply With Quote
  #3  
Old 03-22-2011, 10:39 AM
kmickeletto kmickeletto is offline
Mirth Newb
 
Join Date: Jul 2010
Posts: 24
kmickeletto is on a distinguished road
Default

I probably should have been more specific... The message could have the following...

ORC|RE
OBR|123
OBX|123
NTE|123
ORC|RO
OBR|456
OBX|456
NTE|456

This deletes all of the segments except the ORC's. I am hoping to see it leave the message like this...

ORC|RE
ORC|RO
OBR|456
OBX|456
NTE|456
Reply With Quote
  #4  
Old 03-22-2011, 10:46 AM
AlexToft AlexToft is offline
OBX.3 Kenobi
 
Join Date: Sep 2010
Location: Leeds, UK
Posts: 160
AlexToft is on a distinguished road
Default

Look at the IF condition in the code...
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:55 PM.


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