Wildcard in Table Lookup

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Wildcard in Table Lookup

  • Creator
    Topic
  • #47766
    Cathy Girard
    Participant

      Greetings.

      Our HIS system identifies all allergies as DA (drug allergy) regardless of whether they are food or drug allergies. For the interface of dietary orders to our Nutritional Services Diet System, I have to create a table to identify a food allergy and code it with an FA in the AL1 segment. My question is, can the table entries contain a wildcard? For instance, there may be multiple allergies related to ‘egg’ that have descriptions such as -Egg Nog, Egg Phospholipids, Egg White, Egg Yolk, Eggs. Has anyone every utilized a wildcard such as *egg* for the table entry to be accessed either within an Xlate or tps type tcl proc (preferably)?

      Thanks!

    Viewing 0 reply threads
    • Author
      Replies
      • #56662
        Mike Grieger
        Participant

          Wildcard use isn’t possible in a table lookup.  An alternate solution that I use for this scenario (we’ve just upgraded to a newer Cbord dietary version where allergies have to be built in a ‘dictionary’, and with our users able to free-text in the allergy in the HIS, I do some intervention).  I use a switch statement, give the literal matches to their corresponding new values, and in the default section (section reached if no match in the top section) I have a series of regexp so a wildcard search can be used.

          lassign $xlateInVals allergy_in

          # set up as proc vs. table so that regexp can be used in the default section, if needed

          switch $allergy_in {

          CHEESE {set xlateOutVals NOCHEESE}

          CHICKEN {set xlateOutVals NOCHICKEN}

          CHOCOLATE {set xlateOutVals NOCHOC}

          EGGS {set xlateOutVals NOEGG}

          FISH {set xlateOutVals NOFISH}

          MILK {set xlateOutVals NOMILK}

          MSG {set xlateOutVals NOMSG}

          MUSHROOMS {set xlateOutVals NOMUSH}

          NUTS {set xlateOutVals NONUT}

          PORK {set xlateOutVals NOPORK}

          STRAWBERRIES {set xlateOutVals NOSTRA}

          default { if {[regexp — {LACTOSE} $allergy_in]} {set xlateOutVals NOLACT}

          if {[regexp — {NUTS} $allergy_in]} {set xlateOutVals NONUT}

          if {[regexp — {CARROT} $allergy_in]} {set xlateOutVals NOCARROT}

          if {[regexp — {PEPPER} $allergy_in]} {set xlateOutVals NOPEPPER}

          if {[regexp — {GREEN BEAN} $allergy_in]} {set xlateOutVals NOGRNBEAN}

          }

          }

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