- This topic has 8 replies, 4 voices, and was last updated 15 years ago by .
-
Topic
-
i keep getting this error when running this tclproc. It seems to be working but get the returned bogus strMsgId ‘message0’. I have done some searching found that it is because you are returning more than one mh. i have played around with different scenarios with no luck. Thanks for anyhelp. proc tpsKillAlls_Dr { args } {
#########################################################################################
# Get the Connection/Proc Name for Error/Debug Messages
#########################################################################################
global HciConnName
set myname “$HciConnName/[lindex [info level 1] 0]”
set nowis [clock format [clock scan now] -format “%D – %T”]
#########################################################################################
# Initialize Variables Used
#########################################################################################
set dispList { } ;# Disposition List Returned to Engine
set fldSep “” ;# Field Seperator – get from MSH
set subSep “” ;# SubField Seperator – get from MSH
set repSep “” ;# Repeating Field Seperator – get from MSH
set PV1pos -1 ;# Position of PV1 Segment in msg
set PIDList
- ;# PV1 Segment Fields in List Form
set ConsDrList
- ;# PV1-3 subfields in List Form
set AdmDrList
- ;# PV1-3 subfields in List Form
set defaultvalue {} ;# Value in table when no his is found
set ConsDrLocation 9 ;# Bed number is in field 3 in PV1
set AdmDrLocation 17 ;# Bed number is in field 3 in PV1
set table “Alls_Dr” ;# Table with Dr. number in it.
#########################################################################################
# Switch based on what mode the engine was in when it called the procedure
#########################################################################################
keylget args MODE mode ;# The mode the engine called from
switch -exact — $mode {
start { }
run {
set mh [keylget args MSGID] ;# Get message handle from args
set dispList
-
;# Initialize to good message
set msg [msgget $mh] ;# Get a copy of the message
set fldSep [string index $msg 3] ;# Field Seperator
set subSep [string index $msg 4] ;# Sub-Field Seperator
set repSep [string index $msg 5] ;# Repeating Field Seperator
set segList [split $msg r] ;# Split message into segList
#########################################################################################
# Find Position of Segments – If missing -> Error out Message and Return
#########################################################################################
set PV1pos [lsearch -regexp $segList {^PV1}]
if { $PV1pos < 0 } { msgmetaset $mh USERDATA “Required Segment PV1 Missing!” echo n n n echo “:WARN – PV1 Segment Missing !” echo “:WARN – Sending Message to error db.” echo “:WARN – Here Is: $myname” echo “:WARN – Now Is: $nowis” echo $msg echo n n n set dispList
return $dispList
}
#########################################################################################
# Pull out the dr fields and get the Affinity Dr. code
#########################################################################################
set PV1List [split [lindex $segList $PV1pos] $fldSep]
set ConsDrList [split [lindex $PV1List $ConsDrLocation] $subSep]
set AdmDrList [split [lindex $PV1List $AdmDrLocation] $subSep]
set ConsDr [split [lindex $ConsDrList 0] $subSep]
set AdmDr [split [lindex $AdmDrList 0] $subSep]
#########################################################################################
# Check the Dr. Code with the Alls_Dr.tbl and see if it is a match. If there is a match
# then the message would pass, else kill it.
#########################################################################################
set value [tbllookup $table $ConsDr]
set value2 [tbllookup $table $AdmDr]
if {[string equal $value “YES”] || [string equal $value2 “YES”]} {
lappend dispList “CONTINUE $mh”
} else {
lappend dispList “KILL $mh”
}
#########################################################################################
# Rebuild msg and store at mh for engine
#########################################################################################
lset ConsDrList [join $ConsDr $subSep]
lset AdmDrList [join $AdmDr $subSep]
# echo ConsDrList:$ConsDrList
# lset PV1List $ConsDrLocation $ConsDrList
# lset PV1List $AdmDrLocation $AdmDrList
lset segList $PV1pos [join $PV1List $fldSep]
msgset $mh [join $segList r]
}
time { }
shutdown { }
} ;# End Switch
return $dispList
} ;# End Proc
- ;# PV1 Segment Fields in List Form
- The forum ‘Cloverleaf’ is closed to new topics and replies.