Attached is the tcl proc thus far. When testing with an inbound result such as a metabolic panel, it is not selecting the BUN and CREATININE only in the outbound message. Any suggestions are appreciated.
######################################################################
# Name: tps_remove_specific_obx
# Purpose: remove specific OBX segments
# UPoC type: tps
# Args: tps keyedlist containing the following keys:
# MODE run mode (“start”, “run” or “time”)
# MSGID message handle
# ARGS user-supplied arguments:
#
#
# Returns: tps disposition list:
#
#
proc tps_remove_specific_obx {args} {
keylget args MODE mode
switch -exact — $mode {
run {
keylget args MSGID mh
set msg [msgget $mh]
set segs [split $msg r]
set msg “”
set obxloc [lsearch -regexp $segs “^OBX”]
set obxseg [lindex $segs $obxloc]
set obxtxt [lindex [split $obxseg |] 5]
set obx_fld2 [lindex [split $obxseg |] 2]
set obx_fld3 [lindex [split $obxseg |] 3]
set obx_fld31 [lindex [split $obx_fld3 ^] 1]
set obx_fld4 [lindex [split $obxseg |] 4]
set obx_flds “${obx_fld2}|${obx_fld3}|${obx_fld4}”
set obx_cnt 1
set obx_out “”
foreach obxsg {
if [cequal $obxseg “OBX”] && [cequal $obx_fld31 “BUN”] || [cequal $obxseg “OBX”] && [cequal $obx_fld31 “CREATININE”] {continue}
append obx_out “OBX|${obx_cnt}|${obx_flds}|${obxsg}r”
incr obx_cnt
return “{CONTINUE $mh
}
set new_msg [lreplace $segs $obxloc $obxloc $obx_out]
msgset $mh [join $new_msg r]
else return “{KILL $mh}”
}
default {
}
}
}