thanks for the reply!
So the message could have many OBX’s with each OBR. I dont know if that matters.
I am getting confused on the foreach statement. It keeps putting out multple OBR’s and multple OBX’s This is what I used based on what you gave me:
foreach segment $segmentlist {
set newobr [lsearch -glob -regexp $segmentlist ^OBR]
set OBR [lindex $segmentlist $newobr]
set OBX [lindex $segmentlist [expr $newobr + 1]]
puts $OBR
}
When I print out the OBR for example, it prints out only the first one multple times. I need it to pring each of the ones i have in the message. this is what its doing based on above code:
OBR|1|367718|4050310755|PXCBC1^Parexel Complete Blood Count w/Different|||201512170459|||||||201512170541||||||||201512170550||HEMEH|F||^^^^^R|||||AUTO
OBR|1|367718|4050310755|PXCBC1^Parexel Complete Blood Count w/Different|||201512170459|||||||201512170541||||||||201512170550||HEMEH|F||^^^^^R|||||AUTO
Its doing this multple times.