› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Filtering many Lab Test codes.
I need to send only certain Orders based on Test codes but there are
20 or 30 Test codes .
What would be better ? . Developing a TCL and having all Test codes inside
the TCL or Calling a TCL and passing the Test Codes as ARGuments.
Or anyone have any alternate solutions ?
Paul
Steve
Actually using Jim Kosloskey tps_msg_action proc makes this sort of thing almost effortless.
I often find this useful to only get the test messages I’m working with and not all the others I’m not interested in sifting through.
This should illustrate very nicely how you can do the same for you particular field of interest.
In my case I call tps_msg_action on the pre-xlate route that will filter based on what is defined in my lookup table.
tps_msg_action args:
{COMMENT_1 {filter messages if MRN does not match an entry in table rxtfc_filter_adt_by_mrn}}
{COMMENT_2 {turn on this filter by setting Default to N in table rxtfc_filter_adt_by_mrn}}
{COMMENT_3 {turn off this filter by setting Default to Y in table rxtfc_filter_adt_by_mrn}}
{MSGTYPE {hl7}}
{MSGVERS {2.3}}
{MSGVARNM {global_super_adt}}
{MSGNAME {ADT_A01}}
{FLDID {0(0).PID(0).#3}}
{UPOC1 {{”oth_lookup” {{TBLNM rxtfc_filter_adt_by_mrn} {DEBUG N}}}}}
{MSGOPER {==}}
{VAL2CHK4 {Y}}
{YESACTION {CONTINUE}}
{NOACTION {KILL}}
{LRFLDID {0(0).MSH(0).#9.[0]}}
{LRFLDVAL {END}}
{MSGCTXT {xlt_pre}}
{DEBUG {N}}
tps_msg_action.tcl
######################################################################
# Name: tps_msg_action
# Purpose: Take a user specified action on a message depending
# on a user provided value compared against a user
# specified field.
#
# For example the user specifies:
# MSGCTXT {sms_ob_data} <-- the context we should be in
# MSGTYPE {x12} <-- x12, hl7, or frl
# jrk10121998
# jrk10121998 --> The following 2 parms are optional if MSGTYPE {frl}
# MSGVERS {3.5.0} <-- not appropriate for frl
# MSGVARNM {elig_270} <-- name of rec definition
# jrk10121998
# MSGNAME {270} <-- name of the message
# FLDID {0(0).TA1(0).4#I17.[0]} <-- what field (x12 ex)
# MSGOPER {==} <-- operand for field comparison
# VAL2CHK4 {88888888888888888} <-- FLDID equal to this?
# YESACTION {CONTINUE} <-- what to do if FLDID = VAL2CHK4
# jrk10121998
# jrk08292001 --> The following parameters are optional
# jrk08292001 UPOC0 {mytcl2 args}
# jrk10121998 UPOC1 {mytcl}
# NOACTION {KILL} <-- what to do if FLDID <> VAL2CHK4
# LRFLDID <-- The field for last record check
# LRFLDVAL <-- The value that indicates last record
# DEBUG {Y} <-- do debug stuff?
#
# With the above parameters, the value of the field pointed
# to by (FLDID) for the Message Version (MSGVERS) as defined
# in the variant MSGVARNM will be compared (after any
# modifications made by the Tcl procedure "mytcl" indicated
# by the UPOC1 parameter) with VAL2CHK4 to see if it meets the
# test specified by MSGOPER.
# JRK08292001
# JRK08292001 If the message received does not match the message specified
# JRK08292001 to be retrieved, then the proc "mytcl2" (as indicated by UPOC0)
# JRK08292001 will be executed instead of the normal logging of the event.
#
# If the test evaluates to true, then the action specified in
# YESACTION will be taken against the message otherwise the
# action specified in NOACTION will be used.
#
# ******** N O T E **************
# The value in VAL2CHK4 and found in the field pointed to
# by FLDID will be checked for all numerics. If EITHER value
# is found to be numeric, a 9 character substring of BOTH
# fields will be used for comparison. This is due to the
# inability of the Tcl language to effectively convert
# numerics to strings (like other languages) and Tcl's
# propensity to take control of data type identification.
#
# This may be a serious problem when considering X12 data
# where everything is treated as string data and numbers
# particularly insurance payments, limits, identifiers, etc.
# could exceed nine digits.
#
#
#
# UPoC type: tps
# Args: MODE
# CONTEXT
# MSGCTXT
# MSGTYPE
# MSGVERS
# MSGVARNM
# FLDID
# MSGOPER
# VAL2CHK4
# YESACTION
# NOACTION
# JRK08292001 UPOC0
# UPOC1
# FRFLDID
# FRFLDVAL
# DEBUG
#
# Author: James R. Kosloskey - Oakwood
# Date-written: 06/17/1997
# Returns: tps disposition list:
# Action specified in user parameter YESACTION or
# NOACTION depending on match of VAL2CHK4 against
# value in field specified in FLDID. If last record is detected
# the message is continued thus short circuiting other processing.
#*******************************************************************************
#* C O D E A U D I T *
#*_____________________________________________________________________________*
#*Date I-Catcher Description *
#*---------- ---------- -------------------------------------------------------*
#*06/17/1997 Procedure conceived
#*_____________________________________________________________________________*
#*01/20/1998 jrk012098 Added support for the operands (MSGOPER) and values
#* (VAL2CHK4) to be lists allowing for multiple conditions
#* to be described in one invocation of the procedure.
#* Also added the DEBUG argument.
#*_____________________________________________________________________________*
#*02/13/1998 jrk021398 Added support for the recognition of the last record.
#* The user indicates which field in the record is to be
#* tested and the value to test it against. If the last
#* record is detected, the message is continued and
#* further processing of this message is discontinued.
#*_____________________________________________________________________________*
#*10/06/1998 jrk10061998 Added support to recognize the invoker identifying an
#* HL/7 (hl7) message type.
#*_____________________________________________________________________________*
#*10/12/1998 jrk10121998 Added logic to allow user parameters MSGVERS and
#* MSGVARNM are optional for frl MSGTYPE messages.
#* Also added support for invocation of a user specified
#* user point of control prior to application of the
#* comparison condition(s). The UPOC1 parameter will
#* specify the name of the Tcl procedure to be called out.
#* The UPOC1 invoked Tcl Procedure will receive a copy of
#* the value found in FLDID. The UPOC1 invoked Tcl
#* can then modify the value in any way it desires. This
#* will allow substrings of the fields to be compared
#* among other things.
#*_____________________________________________________________________________*
#*08/29/2001 jrk08292001 Added support for a UPOC0 to be invoked whenever an
#* error is detected at the grmcreate.
#*_____________________________________________________________________________*
#*02/10/2005 jrk02102005 Intialize GRM handle variable (ghd)at local variable
#* initialization. Necessary because proc gets executed
#* when process is shutdown (3.8.1 CL and beyond) and a
#* Tcl error happens when the final handle cleanup is
#* attempted because the ghd variable does not exist
#*_____________________________________________________________________________*
#*03/03/2005 jrk03032005 Asscocuiated with jrk02102005 above, need to check
#* if the GRM Handle (ghd)is populated before trying to
#* destroy it as final catchall cleanup.
#*******************************************************************************
#
################################################################################
# Copyright: Copyright(c) 1997-1998, Oakwood.
# All rights reserved worldwide.
proc tps_msg_action { args } {
global HciConnName ;# Connection Name
global HciSiteDir ;# Site Directory
# jrk08292001 Initialize Local variable
set fatal_err 0 ;# Preset fatal_err
set module "TPS_MSG_ACTION"
set msgaction_var1 ""
set msgvers ""
set msgvarnm ""
set datList ""
set wrnerr ""
set debug "N" ;# jrk08292001
set upoc0 "" ;# jrk08292001
set ghd "" ;# jrk02102005
keylget args MODE mode ;# Fetch mode
keylget args CONTEXT context ;# Fetch context
set ret_cd [keylget args ARGS.MSGCTXT msgctxt] ;# Save the MSGCTXT argument
if {$ret_cd} { ;# Did we find the argument?
} else { ;# If found, don't do nuttin - If not tell
echo "$HciConnName $module: MSGCTXT not found - required!"
set fatal_err 1 ;# Set the fatal_err switch
}
set ret_cd [keylget args ARGS.MSGTYPE msgtype] ;# Save the MSGTYPE argument
if {$ret_cd} { ;# Did we find the argument?
} else { ;# If found, don't do nuttin - If not tell
echo "$HciConnName $module: MSGTYPE not found - required!"
set fatal_err 1 ;# Set the fatal_err switch
}
# jrk10121998 begin
# MSGVERS and MSGVARNM are not required for frl messages (but are
# required for all other message types)
if {$msgtype != "frl"} {
set ret_cd [keylget args ARGS.MSGVERS msgvers] ;# Save the MSGVERS argument
if {$ret_cd} { ;# Did we find the MSGVERS argument?
} else { ;# Yes, do nuttin more, No send error message
echo "$HciConnName $module: Message type is >$msgtype< but cannot locate MSGVERS argument."
set fatal_err 1 ;# Set the fatal_err switch
}
set ret_cd [keylget args ARGS.MSGVARNM msgvarnm] ;# Save the MSGVARNM argument
if {$ret_cd} { ;# Did we find the MSGVARNM argument?
} else { ;# Yes, do nuttin more, No send error message
echo "$HciConnName $module: Message type is >$msgtype< but cannot locate MSGVARNM argument."
set fatal_err 1 ;# Set the fatal_err switch
}
}
# jrk10121998 end
set ret_cd [keylget args ARGS.MSGNAME msgname] ;# Save the MSGNAME argument
if {$ret_cd} { ;# Did we find the argument?
} else { ;# If found, don't do nuttin - If not tell
echo "$HciConnName $module: MSGNAME not found - required!"
set fatal_err 1 ;# Set the fatal_err switch
}
set ret_cd [keylget args ARGS.FLDID fldid] ;# Save the FLDID argument
if {$ret_cd} { ;# Did we find the argument?
} else { ;# If found, don't do nuttin - If not tell
echo "$HciConnName $module: FLDID not found - required!"
set fatal_err 1 ;# Set the fatal_err switch
}
set ret_cd [keylget args ARGS.MSGOPER msgoper] ;# Save the MSGOPER argument
if {$ret_cd} { ;# Did we find the argument?
} else { ;# If found, don't do nuttin - If not tell
echo "$HciConnName $module: MSGOPER not found - required!"
set fatal_err 1 ;# Set the fatal_err switch
}
set ret_cd [keylget args ARGS.VAL2CHK4 val2chk4] ;# Save the VAL2CHK4 argument
if {$ret_cd} { ;# Did we find the argument?
} else { ;# If found, don't do nuttin - If not tell
echo "$HciConnName $module: VAL2CHK4 not found - required!"
set fatal_err 1 ;# Set the fatal_err switch
}
set ret_cd [keylget args ARGS.YESACTION yesaction] ;# Save the YESACTION argument
if {$ret_cd} { ;# Did we find the argument?
} else { ;# If found, don't do nuttin - If not tell
echo "$HciConnName $module: YESACTION not found - required!"
set fatal_err 1 ;# Set the fatal_err switch
}
set ret_cd [keylget args ARGS.NOACTION noaction] ;# Save the NOACTION argument
if {$ret_cd} { ;# Did we find the argument?
} else { ;# If found, don't do nuttin - If not tell
echo "$HciConnName $module: NOACTION not found - required!"
set fatal_err 1 ;# Set the fatal_err switch
}
# jrk10121998 begin
set ret_cd [keylget args ARGS.UPOC1 upoc1] ;#Try to get UPOC1 argument
if {$ret_cd} { ;# UPOC1 is an optional argument
} else { ;# Found, don't do nuttin, else
set upoc1 {{}} ;# if it isn't there make it null
}
# jrk10121998 end
# jrk021398 begin
set ret_cd [keylget args ARGS.LRFLDID lrfldid] ;# Save the LRFLDID argument
if {$ret_cd} { ;# Did we find the argument?
} else { ;# If found, don't do nuttin - If not tell
echo "$HciConnName $module: LRFLDID not found - required!"
set fatal_err 1 ;# Set the fatal_err switch
}
set ret_cd [keylget args ARGS.LRFLDVAL lrfldval] ;# Save the LRFLDVAL argument
if {$ret_cd} { ;# Did we find the argument?
} else { ;# If found, don't do nuttin - If not tell
echo "$HciConnName $module: LRFLDVAL not found - required!"
set fatal_err 1 ;# Set the fatal_err switch
}
# jrk021398 end
keylget args ARGS.DEBUG debug ;# Save the DEBUG argument
# jrk08292001 begin
keylget args ARGS.UPOC0 upoc0 ;# Save the UPOC0 argument (optional)
# jrk08292001 end
#*****************************************************************************************
#* Check to see if any fatal errors happened above.
#* If yes, put messages on the log and return without doing anything.
#* If no, just keep on a truckin'.
#*****************************************************************************************
if {$fatal_err} {
echo "HciConnName $module: Fatal errors occurred while getting arguments (see above)!"
echo "HciConnName $module: NO ACTIVITY PERFORMED!!"
return
}
#*****************************************************************************************
#* Just keep on keepin' on
#*****************************************************************************************
set num_ops [llength $msgoper] ;# Get the number of items in the MSGOPER
;# list
# jrk10121998 begin
set num_upoc1 [llength $upoc1] ;#Get the number of items in the UPOC1
;#list
# jrk10121998 end
if {$debug == "Y"} {
echo "*************************************************************"
echo "*"
echo "$HciConnName $module: MSGCTXT is <$msgctxt>.”
echo “$HciConnName $module: MSGTYPE is <$msgtype>.”
echo “$HciConnName $module: MSGVERS is <$msgvers>.”
echo “$HciConnName $module: MSGVARNM is <$msgvarnm>.”
echo “$HciConnName $module: MSGNAME is <$msgname>.”
echo “$HciConnName $module: FLDID is <$fldid>.”
echo “$HciConnName $module: UPOC0 is <$upoc0>.” ;#jrk08292001
echo “$HciConnName $module: UPOC1 is <$upoc1>.” ;#jrk10121998
echo “$HciConnName $module: Num of elements in UPOC1 <$num_upoc1>.”
echo “$HciConnName $module: MSGOPER is <$msgoper>.”
echo “$HciConnName $module: VAL2CHK4 is <$val2chk4>.”
echo “$HciConnName $module: YESACTION is <$yesaction>.”
echo “$HciConnName $module: NOACTION is <$noaction>.”
echo “$HciConnName $module: LRFLDID is <$lrfldid>.”
echo “$HciConnName $module: LRFLDVAL is <$lrfldval>.”
echo “$HciConnName $module: DEBUG is <$debug>.”
}
set datList [datlist]
switch -exact — $mode {
start {
# Nothing special to be done here just get out
return
}
run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
# Set working variable
set msgval “” ;# Place to hold the message value
set listcnt 0 ;# Counter of the list element we are working on
# Are we in the right context?
if {! [cequal $context $msgctxt]} {
echo “$HciConnName $module: wrong context – $context looking for $msgctxt”
return “{CONTINUE $mh}” ;# Not ours, give it back!
}
# Create a handle and check to see if the message is a valid message
# of the type specified by the caller.
# If it’s not then annotate the log and pass things along.
# if {[catch {set ghd [grmcreate -msg $mh x12 3.5.0 mhmis_eligibility 271]} cerr]} {
if {$msgtype == “frl”} {
if {[catch {set ghd [grmcreate -msg $mh -warn wrnerr $msgtype $msgname]} cerr]} {
#jrk08292001 begin
if {![cequal $upoc0 “”]} {
set sav_msgval [string trim $msgval {””}] ;# Trim ” from msg
set tcl2call [lindex $upoc0 0] ;# The proc is the 1st elem
set arg4tcl [lindex $upoc1 1] ;# The args are the 2nd elem
if {$debug == “Y”} {
echo “$HciConnName $module: Calling >$tcl2call< with args: FLDID >$sav_msgval<, >$arg4tcl<."
}
set ret_cd [catch {set sav_msgval [$tcl2call]} cerr] ;#Call the procedure
if {$ret_cd} { ;#Did the Tcl callout fail?
error "Error - $HciConnName $module: Tcl Callout to $tcl2call failed >$cerr<"
} else {
if {$debug == "Y"} {
echo "$HciConnName $module: Procedure >$tcl2call< invoked without error."
}
}
} else {
echo "$HciConnName $module: Looking for $msgtype $msgname got $cerr"
return "{CONTINUE $mh}" ;# Not ours, give it back!
# echo "$HciConnName $module: Looking for $msgtype $msgname got $cerr"
# return "{CONTINUE $mh}" ;# Not ours, give it back!
}
#jrk08292001 end
}
} else {
if {$msgtype == "x12" || $msgtype == "hl7"} {
#jrk10061998
if {[catch {set ghd [grmcreate -msg $mh $msgtype $msgvers $msgvarnm $msgname]} cerr]} {
echo "$HciConnName $module: Looking for $msgtype $msgvers $msgvarnm $msgname got $cerr"
return "{CONTINUE $mh}" ;# Not ours, give it back!
}
}
}
# }
#
# Let's get the value of the field the invoker requested
#
if {$debug == "Y"} {
echo "$HciConnName $module: Getting the Field."
}
set fhd [lindex [grmfetch $ghd $fldid] 0]
if {$debug == "Y"} {
echo "$HciConnName $module: Getting the datum for the Field."
}
set msgval [datget $fhd VALUE] ;# Get the FLDID value
# jrk021398 begin
#
# Now let's get the value of the last record indication field
#
if {$debug == "Y"} {
echo "$HciConnName $module: Getting Last Record field & datum."
}
set lrfhd [lindex [grmfetch $ghd $lrfldid] 0]
set lrmsgval [datget $lrfhd VALUE] ;# Get the value in the field
#
# Check to see if we have the last record
#
if {[expr {$lrmsgval} == {$lrfldval}] == 1} { ;# compare message field value to
;# the value which indicates a
;# last record.
hcidatlistreset $datList
grmdestroy $ghd
return "{CONTINUE $mh}" ;# last record - send it on
}
# jrk021398 end
#
# Now check to see if either field is numeric, truncate it to 9 characters
# if it is otherwise make sure it is treated as a string by enclosing it
# with double quotes.
#
# if {[ctype digit $msgval] == 1} { ;# Is it numeric?
# set msgval [csubstr $msgval 0 9] ;# Yup, chop it down
# } else { ;# Nope,
# append hldval " $msgval " ;# make sure it's treated like a string
# set msgval $hldval ;# and put it back
# set hldval "" ;# Reset hldval
# }
if {$debug == "Y"} { ;# ***jrk012098
echo "$HciConnName $module: $fldid=$msgval"
} ;# ***jrk012098
#********************************************************************************************
#* *
#* Loop through the lists of operands, values to check for, and upocs. *
#* *
#* *
#********************************************************************************************
# ***jrk012098
set noresult "y" ;# Initialize the indicator that no
;# MSGOPER VAL2CHK4 pair was true.
foreach listval $val2chk4 { ;# Step thru the VAL2CHK4 list
if {$debug == "Y"} { ;# ***jrk012098
echo "----------------------------------------------------------------"
} ;# ***jrk012098
if {$debug == "Y"} { ;# ***jrk012098
echo "$HciConnName $module: Working on list element number <$listcnt>.”
} ;# ***jrk012098
# if {[ctype digit $listval] == 1} { ;# Is it numeric?
# set listval [csubstr $listval 0 9] ;# Yup, chop it down
# } else { ;# Nope,
# append hldval ” $listval ” ;# make sure it’s treated like a string
# set listval $hldval ;# and put it back
# set hldval “” ;# Reset hldval
# }
# Adjust the Operand pointer – If there is just one operand specified, use it for
# all values provided, otherwise allow a one-for-one correlation to occur
if {$num_ops == 1} { ;# Is there only one operand?
set listoper [lindex $msgoper 0] ;# Use that operand
} else {
set listoper [lindex $msgoper $listcnt] ;# Use the corresponding operand to the value
}
#jrk10121998 begin
# Adjust the UPOC1 pointer – If there is just one UPOC1 specified, use it for
# all values provided, otherwise allow a one-for-one correlation to occur
if {$num_upoc1 == 1} { ;# Is there only one UPOC1?
set listupoc1 [lindex $upoc1 0] ;# Use that UPOC1
} else {
set listupoc1 [lindex $upoc1 $listcnt] ;# Use the corresponding operand to the value
}
#Fire off the indicated proc (lindex 0) with the indicated arguments (lindex 1)
# but check to make sure there is a procedure to call.
#The invoker does not have to have a procedure identified with each
#condition set.
set sav_msgval [string trim $msgval {”}] ;# Save off the FLDID value to give to the invoked proc
;# trimming any “.
set tcl2call [lindex $listupoc1 0] ;#Get the name of the Tcl to call
set arg4tcl [lindex $listupoc1 1] ;#Get the arguments for the Tcl being called
if {$listupoc1 != {}} { ;#Is there a procedure to call (listupoc1 not empty)?
if {$debug == “Y”} {
echo “$HciConnName $module: Calling >$tcl2call< with args: FLDID >$sav_msgval<, >$arg4tcl<."
}
set ret_cd [catch {set sav_msgval [$tcl2call]} cerr] ;#Call the procedure
if {$ret_cd} { ;#Did the Tcl callout fail?
error "Error - $HciConnName $module: Tcl Callout to $tcl2call failed >$cerr<"
} else {
if {$debug == "Y"} {
echo "$HciConnName $module: Procedure >$tcl2call< changed >$msgval< to >$sav_msgval<."
}
}
}
#jrk10121998 end
if {$debug == "Y"} {
echo "$HciConnName $module: <$sav_msgval> $listoper <$listval> ?”
}
if {[expr {$sav_msgval} $listoper {$listval}] == 1} { ;# compare message field value to
;# user specified value utilizing user specified
;# operand
if {$debug == “Y”} { ;# ***jrk012098
echo “$HciConnName $module: Doing YESACTION <$yesaction> as a result of $sav_msgval $listoper $listval in $fldid.”
} ;# ***jrk012098
hcidatlistreset $datList
grmdestroy $ghd
return “{$yesaction $mh}” ;# True? do the yesaction
set noresult “n” ;# set switch to no
}
incr listcnt 1 ;# Tells us which element in the list we are on
} ;# End Foreach
#********************************************************************************************
#* *
#* Loop is over. Now check to see if any of the conditions were true, or if they all were *
#* false. *
#* *
#* If ANY conditions were true – do the specified YESACTION. *
#* *
#* If NONE of the conditions were true – do the specified NOACTION. *
#* *
#********************************************************************************************
if {$debug == “Y”} { ;# ***jrk012098
echo “—————————————————————-”
} ;# ***jrk012098
if {$debug == “Y”} {
echo “$HciConnName $module: noresult switch = <$noresult>.”
}
if {$noresult == “y”} { ;# Did the noaction prevail?
if {$debug == “Y”} { ;# ***jrk012098
echo “$HciConnName $module: Doing NOACTION <$noaction> as a result of NOT $sav_msgval $listoper $listval in $fldid.”
} ;# ***jrk012098
hcidatlistreset $datList
grmdestroy $ghd
return “{$noaction $mh}” ;# do the noaction
}
if {$debug == “Y”} { ;# ***jrk012098
echo “*”
echo “*************************************************************”
echo “*”
} ;# ***jrk012098
# ***jrk012098
}
shutdown {
# Doing some clean-up work
}
default {
error “$HciConnName $module: Unknown mode ‘$mode’.”
}
}
hcidatlistreset $datList
if {![cequal $ghd “”]} { ;# jrk03032005
grmdestroy $ghd ;# jrk03032005
} ;# jrk03032005
}
oth_lookup.tcl
################################################################################
# Name: oth_lookup
# Purpose: Perform Table Lookup
# UPoC type: other
# Args: upvar 2 arguments
# sav_msgval – the value of the message field to be handled
# arg4tcl – the additional argument block
# which will tell us what table to lookup
# in.
# A DEBUG parameter is also provided.
# Author: Jim Kosloskey
# Date-written: 12/15/1998
#
#**************************************************************************************************************
#* C O D E A U D I T *
#*_____________________________________________________________________________*
#*Date I-Catcher Description *
#*———- ———- ———————————————–*
#*03/15/2004 jrk031504 Added version number to module ID.
#* Changed use of translit to string toupper.
#*
#*______________________________________________________________________________*
#*
#*______________________________________________________________________________*
#**************************************************************************************************************
#
# Notes:
# This procedure is intended to be invoked from another Tcl procedure.
# The invoking procedure needs to deliver the following arguments:
# msgval – the message to be used for the lookup key
# arg4tcl – an argument block consisting of a keyed list with the following values:
# TBLNM – This key has a value associated with it which tells this proc what
# table to do the tbllookup to.
# DEBUG – This key has a value associated with it which tells this proc to
# produce displayed values of variables and actions within this
# proc for the purposes of debug. A value of Y or y will turn debug
# on – any other value will turn debug off.
# The arg4tcl block would have this look: {{TBLNM “mytable”} {DEBUG “y”}}
#
################################################################################
#
# Copyright: Copyright(c) 1998, Oakwood Healthcare System. All rights reserved.
proc oth_lookup { } {
global HciConnName ;#Get the connection name
# Upvar the variables from the invoker
upvar sav_msgval msgval
upvar arg4tcl arg4tcl
set tablename “”
set mydebug_sw “N”
# jrk031504 Start
set module “OTH_LOOKUP v1.1”
# jrk031504 End
# Check for DEBUG The debug_sw variable will contain the provided arg
set ret_cd [keylget arg4tcl DEBUG mydebug_sw]
if {$ret_cd} { ;# Found the argument
} else { ;# Couldn’t find the argument
echo “$HciConnName $module ERROR!!: Cannot locate DEBUG!”
return
}
# jrk031504 Start
set mydebug_sw [string toupper $mydebug_sw] ;#Change lower to upper case Y
# jrk031504 End
#Get TBLNM
set ret_cd [keylget arg4tcl TBLNM tablename]
if {$ret_cd} { ;# Found the argument
} else { ;# Couldn’t find the argument
echo “$HciConnName $module ERROR!!: Cannot locate TBLNM!”
return
}
#If debug – display received arguments
if {$mydebug_sw == “Y”} { ;#Debug on?
echo “$HciConnName $module: argument block = >$arg4tcl<"
echo "$HciConnName $module: TBLNM = >$tablename<"
echo "$HciConnName $module: DEBUG = >$mydebug_sw<"
echo "$HciConnName $module: ---- Looking up >$msgval< in Table named >$tablename<."
}
#Do the lookup
if {[catch {set msgval [tbllookup $tablename $msgval]} cerr]} {
echo "$HciConnName $module ERROR!!: While trying to lookup table >$tablename< got >$cerr<."
echo "$HciConnName $module : returning null ><."
return ""
} else {
# If debug - display the result
if {$mydebug_sw == "Y"} { ;#Debug on?
echo "$HciConnName $module: ---- resulting in msgval = >$msgval<."
}
return $msgval
}
}
Attached is a partial screen shot of the lookup table.
Russ Ross
RussRoss318@gmail.com
That is beacuse I’m finished with my testing and want to allow all MRN’s to come across at this time.
This is very handy because should I want to toggle the filter on or off all I have to do is change the table default value.
Russ Ross
RussRoss318@gmail.com