Originally posted by gricelda lopez
Hi there
My goal is to replace the "&" for the word "and" in PV2-3. In my pre proc I was able to see it work in test but when i attached it to my thread config it didn't work. This is my first proc and I am thinking it didn't work becuase it isn't writing out the updated field into the segment. Please help..below is my code
######################################################################
# Name: replaceAmpersand
# Purpose: Filters all transactions with no mrn
#
proc replaceAmpersand { args } {
global HciConnName
#Get mode start or run
set mode [keylget args MODE]
switch -exact -- $mode {
start { return ""
}
run {
#get message handle
set mh [keylget args MSGID]
#The returned disposition list, assumes good message
set dispList
set msg [msgget $mh] ;#Get a copy of the messageecho The Message content follows....echo $msgset fldSep [string index $msg 3] ;#Normally| set subSep [string index $msg 4] ;#Normally^set outbuf {}#Variable to set where the bad character might appearset segList [split $msg r]set PV2 [lindex [lregexp $segList {^PV2}] 0]set PV2flds [split $PV2 $fldSep]set PV2_3 [lindex $PV2flds 3] echo Segment List =$segListecho PV2 = $PV2 echo PV2flds = $PV2fldsecho complaint = $PV2_3 set newPV2_3 [regsub -all -- {s*&s*} $PV2_3 { AND }] echo new PV2_3= $newPV2_3 msgset $mh $outbuf }return $dispList } }