- This topic has 7 replies, 3 voices, and was last updated 15 years, 1 month ago by .
-
Topic
-
We were tasked to write a filter which kills a message based on two Insurance Company IDs. If “123” is in IN1_3.1 or if “567” is in IN2_3.1, kill the message. They have since added 50 codes that need to be added to the filter. I.E. If any of the 50 codes are in IN1_3.1 or in IN2_3.1, kill the message. Can someone recommend how to do this without having to write a mile long IF statement?
Below is a portion of the filter.
# Here we retrieve the data from our original message
set msg [msgget $mh]
# Now we need to determine our field and subcomponent seperatoprs
set field_sep [csubstr $msg 3 1] ;# HL7 field separator
set sub_sep [csubstr $msg 4 1] ;# HL7 subfield separator
set disposition “KILL”
# Here we spilt the original message into a list of the segments contained within
set segmentList [split $msg r]
foreach segment $segmentList {
if {[cequal [crange $segment 0 2] IN1]} {
set fieldList [split $segment $field_sep]
set in1_3 [lindex $fieldList 3]
set in1_3_list [split $in1_3 $sub_sep]
set in2_3 [lindex $fieldList 3]
set in2_3_list [split $in2_3 $sub_sep]
set in1_3_1 [lindex $in1_3_list 0]
set in2_3_1 [lindex $in2_3_list 1]
puts “this is in1_3_1: $in1_3_1”
puts “this is in2_3_1: $in2_3_1”
if {[cequal $in1_3_1 “123”] || [cequal $in2_3_1 “567”]} {
set disposition “KILL”
} else {
set disposition “CONTINUE”
Thanks in advance for any suggestions.
- The forum ‘Cloverleaf’ is closed to new topics and replies.