AIX 5.2
Version 5.3 rev2
I have been tasked with performing three tasks on a patient location in tcl. I can get the first to work but not the third.
1. If patient room and bed are *NA strip the *NA from the pat room, bed, and only send the Nurse Station.
2. Convert single digit bed number to two digit bed numbers ex- 1 to 01.
I am using a table converting 1-9 to 01-09 with UNKNOWN as the default.
3. Send bed if not in table. Ex- DR, WN, 11
Below is the IF I am using to try achieve the above. The code does strip the *NA, and sets the single digit bed to two, but returns the value UNKNOWN for any bed not in the table.
set roomout {}
if [string match *NA $patroom] {
set roomout {}
} else {
set roomout $patroom
}
set bedout {}
if [string match *NA $patbed] {
set bedout {}
} else {
set bedout [tbllookup idxevm_bednum_2_CSY_bednum.tbl $patbed]
if ![string match NOTFOUND $bedout] {
set bedout $bedout
} else {
set bedout $patbed
}
}
Any help would be appreciated. I am now sleep deprived because I could not get the IF out of my head last night.