- This topic has 4 replies, 3 voices, and was last updated 14 years, 10 months ago by .
-
Topic
-
Hello , I have a tcl which filters the Patient Class – field PV1.2 using arguments passed.
So far it works great to filter those messages which contain a PV1 .
I want to use it for all my ADT messages but A60 and A34s do not contain a PV1
Using this tcl for the messages without a PV1 does not produce any message.
I hoped to CONTINUE with the message if it did not contain a PV1.
Any thoughts ?
Code:proc tps_class_Filter { args } {
keylget args MODE mode ;# Fetch modeset dispList {} ;# Nothing to return
switch -exact — $mode {
start {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
}run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
keylget args ARGS.PTCLASS ptclass ;# Fetch Patient class from arguments
set msg [msgget $mh]
set segmentList [split $msg r]
set fieldSeparator [crange $msg 3 3 ]# Split Args passed into list.
set classLst [split $ptclass |]foreach segment $segmentList {
if {[crange $segment 0 2] == “PV1″} {
set fieldList [split $segment $fieldSeparator]
set PV1f2 [lindex $fieldList 2]
# echo $classLst
foreach class $classLst {
if [cequal $PV1f2 $class] {
lappend dispList “KILL $mh”
return $dispList
}
}
lappend dispList “CONTINUE $mh” ;# CONTINUE the Message
return $dispList
}
}
}time {
# Timer-based processing
# N.B.: there may or may not be a MSGID key in args
}shutdown {
# Doing some clean-up work
}default {
error “Unknown mode ‘$mode’ in tps_class_Filter”
}
}return $dispList
}
- The forum ‘Tcl Library’ is closed to new topics and replies.