Homepage › Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › replacing text in an HL7 ADT (TCL) › Reply To: replacing text in an HL7 ADT (TCL)
set data [msgget $mh]
set fld_delim [cindex $data 3]
set split_data [split $data r]
set pv1_index [lsearch $split_data “PV1*”]
if {$pv1_index == -1} {error “No PV1 segment!”}
set pv1 [lindex $split_data $pv1_index]
set split_pv1 [split $pv1 $fld_delim]
# Now start changing the data and work towards a new message.
set split_pv1_new [lreplace $split_pv1 2 2 “New Data”]
set pv1_new [join $split_pv1_new $fld_delim]
set split_data_new [lreplace $split_data $pv1_index $pv1_index $pv1_new]
set data_new [join $split_data_new r]
msgset $mh $data_new