Using a table in tc proc

Clovertech Forums Read Only Archives Annoucements Comments and Suggestions Using a table in tc proc

  • Creator
    Topic
  • #48610
    Thomas Fortino
    Participant

      Hello All,

      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.

    Viewing 0 reply threads
    • Author
      Replies
      • #59152
        James Cobane
        Participant

          Thomas,

          The table lookup will always return the default value specified for the table if the input value is not found in the table; so you’ll need to change your code to compare against the value ‘UNKNOWN’ (since that is the ‘Default’ value specified for the table, which is what will get returned if the input value is not found in the table); i.e.

          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 UNKNOWN $bedout] {

          set bedout $bedout

                 } else {

          set bedout $patbed              

                }

            }

          Jim Cobane

          Henry Ford Health

      Viewing 0 reply threads
      • The forum ‘Comments and Suggestions’ is closed to new topics and replies.