using TABLE LOOKUP to send labs

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf using TABLE LOOKUP to send labs

  • Creator
    Topic
  • #49341
    Duy Nguyen
    Participant

      We have an interface set up with a  lab vendor and we only want to send these labs to physicians who want to receive them.  

      I have created a TABLE called _LABS_allow.tbl

      The IN values are the names/codes of the doctors who want to receive.

      The OUT values I have labeled as “CONTINUE”

      My default value is “KILL”

      My question is…within the xlate, after I place a table in and go into the PROPERTIES, on the source I choose OBR-16 (which is the ordering provider’s name), what should i set the destination to be?

      I have thought about setting the destination to a temporary variable called @DISP    for disposition

      and then following up by using an IF statement:   IF @DISP eq =KILL, then suppress the message.  

      Would this method be valid?  Are there easier ways of doing this?  I know this is not the most efficient/ideal and I’m interested in doing this before the XLATE but in a SIMPLE way.  Thanks in advance.

    Viewing 10 reply threads
    • Author
      Replies
      • #61564
        Charlie Bursell
        Participant

          You certainly don’t want to do it in Xlate!  Kill it before Xlate!

          Write a Tcl proc.  In the Tcl proc, extract the name from the message and then bump that against the table using the command:

              set var [tbllookup ]

          if var = KILL, kill the message, else continue it.

          The proc could be placed in the Inbound or in a route.

          FWIW, if this is to be a dynamc table that changes often, there are better methods than using a Cloverleaf Table.  For example, you could have someone maintain the table as an Excel Spreadsheet and then, when it changes, save it as a Comma Separated Value (CSV) file.

          Lot’s of options  ðŸ˜€

        • #61565
          Gary Atkinson
          Participant

            Do you have to store the .csv file in the tables directory with the cloverleaf tables?

          • #61566
            Charlie Bursell
            Participant

              No.  Access like any file.  Use the csv package available with tcllib

            • #61567
              Duy Nguyen
              Participant

                I decided to go the TCL route and found some existing code that I will borrow…why reinvent the wheel, right?

                There is, however, one line of code (in green highlight) that I do not understand what it’s trying to do, would you assist me in explaining what it does?

              • #61568
                Robert Weisser
                Participant

                  The following line:

                  Code:

                  if {![string length $disp]} {set disp KILL}

                  means:  if the length of $disp is 0, set disp to KILL.

                • #61569
                  Charlie Bursell
                  Participant

                    Kind of wierd but I guess it will work if your table is setup OK.

                    It looks like whoever wrote this expects the table to return a message disposition, i.e., KILL, CONTINUE, etc.  However, if it returns an empty string set it to KILL.  If the empty string is returned, the string length will be 0,

                    I assume your table is setup to send CONTINUE if a match is found and KILL (defualt) if not found.  In that case both of the statements below are superflous:

                       set disp CONTINUE

                       if {![string length $disp]} {set disp KILL}

                    I would however put the tbllookup command inside of a catch statement just in case.  For example:

                           if {[catch [tbllookup Quest_ALLOW $obr16} disp]} {

                                    echo  nError during Table Lookup table Quest_ALLOW

                                    echo $disp

                                    msgmetaset $mh USERDATA “$disp”

                                    return “{ERROR $mh}”

                            }

                    Of course you would cahnge the error message(s) to suit your own needs.

                    FWIW:  hcitbllookup and tbllookup are the same.

                  • #61570
                    Duy Nguyen
                    Participant

                      Charlie Bursell wrote:

                      Kind of wierd but I guess it will work if your table is setup OK.

                      It looks like whoever wrote this expects the table to return a message disposition, i.e., KILL, CONTINUE, etc.

                    • #61571
                      Charlie Bursell
                      Participant

                        It would depend on how your table is setup.  If your table retrns CONTINUE if found an KILL if not found then #3 is superflous.

                      • #61572
                        Duy Nguyen
                        Participant

                          Charlie Bursell wrote:

                          It would depend on how your table is setup.

                        • #61573
                          Michael Hertel
                          Participant

                            Correct me if I’m wrong, but wasn’t there a time (maybe a hundred years ago) when the tbllookup command (or maybe Xlate tbllookup function) did not return the default value and returned null when a match was not made?

                          • #61574
                            Charlie Bursell
                            Participant

                              As far as I know the tbllookup command whether from Tcl or Xlate has not changed since the beginning.  If you do not define a default, the empty string is used.

                              We have been trying to get it change so that the default could be a meta-character that would cause the lookup string to be returned.

                          Viewing 10 reply threads
                          • The forum ‘Cloverleaf’ is closed to new topics and replies.