Forum Replies Created
-
AuthorReplies
-
Ok that does get them all to come out. What Im trying to do is run those numbers against a table. The current way seems to group the numbers together. Here is the full tclproc: I want to run each of those number against the table. Thanks for your help.
proc tpsKillAlls_ORC_OBR { 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 ORCpos -1 ;# Position of ORC Segment in msg
set OBRpos -1 ;# Position of OBR Segment in msg
set ORCList
- ;# ORC Segment Fields in List Form
set OBRList
- ;# OBR Segment Fields in List Form
set ORCDrList
- ;# ORC subfields in List Form
set OBRDrList
- ;# OBR subfields in List Form
set defaultvalue {} ;# Value in table when no his is found
set ORCDrLocation 12 ;# Dr name
set OBRDrLocation 16 ;# Dr name
et OBRDrCC 28 ;# Dr name that is cc for result
set table “Alls_EHR_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 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 ORCpos [lsearch -regexp $segList {^ORC}]
set OBRpos [lsearch -regexp $segList {^OBR}]
#########################################################################################
# Pull out the dr fields and get the Affinity Dr. code
#########################################################################################
set ORCList [split [lindex $segList $ORCpos] $fldSep]
set ORCDrList [split [lindex $ORCList $ORCDrLocation] $subSep]
set ORCDr [split [lindex $ORCDrList 0] $subSep]
set OBRList [split [lindex $segList $OBRpos] $fldSep]
set OBRDrList [split [lindex $OBRList $OBRDrLocation] $subSep]
set OBRDr [split [lindex $OBRDrList 0] $subSep]
set OBRList [split [lindex $segList $OBRpos] $fldSep]
set OBRDrList [split [lindex $OBRList $OBRDrCC] $repSep]
echo $OBRDrList
foreach Dr $OBRDrList {
set DrNumber [lindex [split $Dr $subSep] 0]
lappend DrCCList $DrNumber
}
echo $DrCCList
msgset $mh [join $segList r]
#########################################################################################
# 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 $ORCDr]
set value2 [tbllookup $table $OBRDr]
set value3 [tbllookup $table $DrCCList]
if {
[string equal $value “YES”]
|| [string equal $value2 “YES”]
|| [string equal $value3 “YES”]
} then {
lappend dispList “CONTINUE $mh”
} else {
lappend dispList “KILL $mh”
}
}
time { }
shutdown { }
} ;# End Switch
return $dispList
} ;# End Proc
Now it just groups the numbers:
0839 6061 6061
Why is that.
sorry
That wroks and shows the values that I need but if i echo the DrNumber out side the brackets it only gives me the last Dr. I was it that.
set OBRList [split [lindex $segList $OBRpos] $fldSep]
set OBRDrList [split [lindex $OBRList $OBRDrCC] $repSep]
echo $OBRDrList
foreach Dr $OBRDrList {
set DrNumber [lindex [split $Dr $subSep] 0]
echo $DrNumber
}
echo $DrNumber
msgset $mh [join $segList r]
Here is what it echo’s
0839^JUDY^JANE^^^^ 6061^JONES^BOB^^^^ 6061^KEVIN^COOL^^^^
0839
6061
6061
6061
That worked!
Thanks
Ok. I’m new with the Tcl and I have tried what you said and still having some issues. Do you have an example that I could see?
Check to make sure your Wild Card Route is not checked
I got it to work. The pathcopy was causing me the issue and once I switched it to copy it all started to work. Thanks for everyone
Ok, I think I got it the way you said but I did that before but I guess the reason I didn’t keep that way was because of this error I get. I don
I think I did what you told me to and I’m still having the same problem. Here are some screen shoots of the Xlate and Results. It keeps filling out the GT1 that should not be coming across.
Ok, I’m still having a small issue. It keeps picking up the GT1 that i nulled out. Here is my xlate and what it keeps doing. Can anyone hlep with this. As you can see it keeps putting the 1 in the null GT1. I have moved all these areound trying to get this to work and have had no luck.
Thanks,
Steven
Thanks Russ
It works. Thanks for everyones help.
Thanks Robert,
I’m still getting an error. Here is a screen shot of my Xlate and the error.
Thanks,
Steven
can you give me an example
The hole GT1 segment
It is a repeating field. Here is what the message looks like and I want to delete the GT1 if it as a *
- ;# ORC Segment Fields in List Form
-
AuthorReplies