Need to Trim Leading Zeroes from MRN

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Need to Trim Leading Zeroes from MRN

  • Creator
    Topic
  • #51896
    Ariba Jones
    Participant

      I am trying to trim the leading zeroes from the MRN number in PID-3.1.  I have this proc that I am trying to use, but I am getting an error message in my xlate that the variable is not defined.  I don’t know what else to do with this.  I am not TCL savvy.

      Can anyone tell me what I need to do for this?  Or if there are any other suggestions, I will be happy to try them.  I need to get this working by end of day today, if possible.  

      proc TrimLeadingZeroes {n} {

         if {[string length $n] == 0} {return “”}

         set trimmed [string trimleft $n 0]

         if {[string length $trimmed] == 0} {

      return “0”

         } else {

      return $trimmed

         }

      }

    Viewing 3 reply threads
    • Author
      Replies
      • #72166
        Gary Atkinson
        Participant

          set xlateOutVals [ string trimleft $xlateInVals 0 ]

        • #72167
          Jim Kosloskey
          Participant

            Ariba,

            If you want an xltp type proc (Xlate) that trims charactrs (right or left any characters) email me and I will send you one we use.

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

          • #72168
            Ariba Jones
            Participant

              Gary,

              I just tried this and it still doesn’t work.

              Here’s what my proc looks like:

              proc TrimLeadingZeroes {n} {

                 set xlateOutVals [string trimleft $xlateInVals 0]

                 if {[string length $n] == 0} {return “”}

                 set trimmed [string trimleft $n 0]

                 if {[string length $trimmed] == 0} {

              return “0”

                 } else {

              return $trimmed

                 }

              }

              Here’s the error I receive in the Testing Tool when I try to test my xlate using this tcl.

              MESSAGE 1

              [0:TEST] [mid:0x30000050] unknown segment ‘ZOM’ — ignored.

              Tcl callout error

              erroCode: NONE

              errorInfo:

              no value given for parameter “n” to “TrimLeadingZeroes”

                 invoked from within

              “TrimLeadingZeroes”

            • #72169
              Gary Atkinson
              Participant

                Just put the code in the tcl box.

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