Keying off the first two letters

Clovertech Forums Read Only Archives Cloverleaf Tcl Library Keying off the first two letters

  • Creator
    Topic
  • #51817
    Steven Lindsey
    Participant

      In the OBR_4 i have a number that comes in FT8756.  The numbers dont matter but I need to change the OBR_4 if it comes in with and FT.  How can I search for the FT.  I’m currently using a Tclproc to do this.  Any help would be great.

      Thanks,

      Steven

    Viewing 3 reply threads
    • Author
      Replies
      • #71836
        Tom Rioux
        Participant

          You can do something like this:

          set num “FT8756”

          if {[regexp -lineanchor ^FT $num]} {

              do something

          } else {

              do somethine else

          }

          Quite frankly, you may can get away with just the — for the options, but I like stating the options.   Don’t quite trust it without it.

          Hope this helps..

          Tom Rioux

        • #71837
          Steven Lindsey
          Participant

            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?

          • #71838
            Jim Kosloskey
            Participant

              Here is another way:

              if {[string equal [string range $obx_4 0 1] “FT”]} {

                 do something…

              } else {

                 do something…

              }

              email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

            • #71839
              Tom Rioux
              Participant

                Here is an example of a tcl fragment we use in our xlate to check if the referring physician ID begins with “TX”.   If it does, we set the outbound to that number, else we set it to a default facility specific ID.

                set ref [lindex $xlateInVals 0]

                set def [lindex $xlateInVals 1]

                if {[regexp -lineanchor ^TX $ref]} {

                   set xlateOutVals $ref

                } else {

                   set xlateOutVals $def

                }

                Hope this helps…

                Tom Rioux

            Viewing 3 reply threads
            • The forum ‘Tcl Library’ is closed to new topics and replies.