tcl – Trimming OBR-3

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf tcl – Trimming OBR-3

  • Creator
    Topic
  • #50950
    Tom Arrowsmith
    Participant

      Hello,

      I’d like to trim the OBR-3.1 in the following message:

      MSH|^~&|HBOC|L|PCM|L|200906051009|09|ORM^O01|5176777|D|2.2|5176777||AL||

      PID||00435224|0419932^^^L||PICIS^ERLDIAG^^||19500103|M|||||||^||^|0915600003^^^L||

      ORC|SC|1227111^IBEX|0000007821L14001^HBOX|99999982550L138110^HBOC|IP|N|1^^^200906051008^^^^^||200906051009|U380^^^||930^PUCCIO^EDWARD^V|ED^||200906051008|||ED^|

      OBR|1|1227111^IBEX|0000007821L14001^HBOX|14001^XR ABD FLAT,ERECT W/CXR^RAD||||||||||||930^PUCCIO^EDWARD^V||||||200906051009|||CHECKED IN||1^^^200906051008^^^^^|||ST^STRETCHER^RAD|^sob|||||

      I need the first ten digits – or conversely, I need to strip off from the “L” onward (inclusively, for example – 0000007821)

      My instict tells me something that keys in on the “L” and everything to the right would be the best solution – as I can’t be absolutely sure that there will always be ten digits to the left or 5 digits to the right of then “L”

      Any help with this is appreciated!

      Tom Arrowsmith

      (703) 779-5474

    Viewing 1 reply thread
    • Author
      Replies
      • #68165
        Jim Kosloskey
        Participant

          Tom,

          You will need to deploy Tcl.

          I would consider using the split Tcl command and split on the ‘L’ based on what you have stated.

          I have taken the liberty to email you a reusable split proc we use here along with its Doc. Feel free to use it if you like.

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

        • #68166
          Tom Rioux
          Participant

            Tom,

            If all you need is the first 10 characters, try this string map command on for size and see if it works for you:

            string map -nocase “[regexp -inline {L[0-9]+$} $num] “”” $num

            Hope this helps….Tom

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