Jim:
Senior moment 😀
I think he wants to ignore OBR segments without following OBX.
Two ways, Tcl or Xlate
In Xlate just make the OBR optional and do no copy it if no following OBX.
In Tcl, something like ( Gets a bit convoluted to keep track of locations)
Assumes HL7 has been split already
# Location of all OBR segments
set locList [lsearch -all -regexp $segList {^OBR}]
while {$locList ne “”} {
set loc [lvarpop locList] ;# Get OBR location
set nxt [expr $loc +1] ;# Location of following segment
#echo loc [lindex $segList $loc]
#echo nxt [lindex $segList $nxt]
# If next segment not OBX
if {![regexp — {^OBX} [lindex $segList $nxt]]} {
lvarpop segList $loc ;# Remove OBR
# Decrement each following OBR location
set cnt 0
foreach num $locList {
incr num -1
set locList [lreplace $locList $cnt $cnt $num]
incr cnt
}
}
}
msgset $mh [join $segList r]
As I said, a bit convoluted. Maybe Xlate best option