|
#1
|
|||
|
|||
|
Currently my transformer deletes a list of unwanted segments.
delete msg['ZIR']; delete msg['ZEN']; delete msg['ZSP']; Is there a way to keep only the segments that I need without using the static delete so that changes in the source message such as adding another z or IN segment do not affect the channel? Something along the lines of: If segment is not MSH, PID PV1 then delete segment. |
|
#2
|
|||
|
|||
|
for each (seg in msg)
{ segName = seg.name().toString(); if(segName != 'PID' && segName != 'MSH' && segName != 'PV1') { delete seg; } } |
|
#3
|
|||
|
|||
|
If you have a large set of segments you want to keep you could do this:
Code:
var strGoodSeg = 'MSH~PID~PV1~NK1~OBR' //you get the point right?
for each (seg in msg.children()) {
var strCurSeg = seg.name();
if (strGoodSeg.indexOf(strCurSeg) < 0) { //okay to delete
delete seg;
}
}
__________________
I can be reached through gmail and Google Talk using davidrothbauer at gmail dot com http://www.linkedin.com/pub/david-rothbauer/5/923/518 hl7coders.wordpress.com Test all my code suggestions prior to implementation |
![]() |
| Tags |
| delete segment, segment |
| Thread Tools | |
| Display Modes | |
|
|