I am trying to use the below code to determine what my route pattern will be for the inbound ORM messages. The code is making the correct trxid determination, but it is not being returned out to the thread.
Error Message:
No_Harvest
[tps :tps :ERR /0: fr_Epic_ORM:01/10/2013 13:20:45] ‘No_Harvest’ (returned by ‘tps_Test_ ‘) does not match {
Yes_Harvest
[tps :tps :ERR /0: fr_Epic_ORM:01/10/2013 13:20:45] ‘Yes_Harvest’ (returned by ‘tps_Test_ ‘) does not match {
proc tps_Test_ {args} {
keylget args MODE mode
set trxid {}
# Get the message id
set inMH [keylget args MSGID]
#this is the message
set data [split [string trimright [msgget $inMH] r] r]
# for each line in the message
foreach segment $data {
# determine what segment this is
set hdr [crange $segment 0 2]
# if we found an obr segment, this is what we want
# handle it
if {$hdr == “OBR”} {
# split the fields base on the standard delimiter
# and identify the field that we are looking for
set fields [split $segment |]
set obr4 [lindex $fields 4]
# check if the word “harvest” (regarless of case)
# is in the field.
set is_harvest [regexp -nocase harvest $obr4]
# set the out trxid based on the findings
if {$is_harvest == 1} {
echo Yes_Harvest
set trxid “Yes_Harvest”
} else {
echo No_Harvest
set trxid “No_Harvest”
}
}
}
return $trxid
}