- This topic has 5 replies, 4 voices, and was last updated 15 years, 2 months ago by .
-
Topic
-
I have a proc on a raw route. I need help in removing the NTEs associated with the unwanted OBXs I am already removing based on whats in OBX:5. This is my code that removes the unwanted OBXs.
Thanks in advance for suggestions, etc.
proc strip_OBX_seg { args } {
global HciConnName
set mode [keylget args MODE]
set context [keylget args CONTEXT]
if { ! [info exists HciConnName] } {
set HciConnName “UNKNOWN_TD”
}
switch -exact — $mode {
start {
return “” ;# Nothing specific
}
run {
set mh [keylget args MSGID] ;# Message handle
set msg [msgget $mh] ;# The message
#
# Get the hl7 segments
#
set fldsep [csubstr $msg 3 1] ;# Field sep, usually “|”
set subsep [csubstr $msg 4 1] ;# SubField sep (^)
set insegs [split $msg r] ;# Inbound segments
set outmsg “” ;# Holds new message
# Loop through looking for OBX segments.
# To remove “DNR” and don’t store in new message
foreach seg $insegs {
if {[regexp — {^OBX} $seg]} {
set fld5 [lindex [split $seg $fldsep] 5]
# If field 5 is “DNR” or “TNP”, toss it, else save it in the buffer
if {[cequal [string trim $fld5 0] “DNR”] || [cequal [string trim $fld5 0] “TNP”]} {continue}
append outmsg $seg r
} else {
append outmsg $seg r
}
}
#
# Now continue message
#
msgset $mh $outmsg ;# Store buffer in original message
return “{CONTINUE $mh}”
}
shutdown {
# Doing some clean-up work
}
default {
return “” ;# don’t know what to do
}
}
}
- The forum ‘Cloverleaf’ is closed to new topics and replies.