Check and extract string

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Check and extract string

  • Creator
    Topic
  • #50920
    Gary Atkinson
    Participant

      Hey TCL experts!  I need to check and extract a string in OBX:5.  Here is an example of the string in question:

      Code:


      Reference range: 0 to 35

      In a tcl, to check for “Reference range” and if found in OBX:5 to copy the values after that could vary(In this case 0 to 35) to OBX:7.  

      I would add this in a proc, so I can add into the xlate.  Of note, the string “Reference range” will also appear in the beginning of the string.

      Thx in advance!!

      Gary

    Viewing 1 reply thread
    • Author
      Replies
      • #68017
        Charlie Bursell
        Participant

          What you didn’t say is do you want to copy anything to OBX.7 if Reference Range is not found.  A COPY will *ALWAYS* copy something to the OB field.

          Let us assume you don’t want anything to OBX.7 if Reference Range not found.  Use a CALL instead of a COPY

          CALL  ODX.5  -> OBX.7

          set inp [lindex $XlateInVals 0]

          if {[regsub  -nocase — {Reference range[^d]*} $inp {} inp]} {

                 set outAddr [lindex $xlateOutList 0]

                  xpmstore $xlateID $outAddr c $inp

          }

          This is all you need.  If Reference range is found the range will be copied to OBX.7 else it is as if the statement does not exist

        • #68018
          Gary Atkinson
          Participant

            Thanks that is what I needed.   8)

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