adding space to phone number in frl from hl7

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf adding space to phone number in frl from hl7

  • Creator
    Topic
  • #47889

    please help!! I have a tcl that will take a string phone number and format correctly, it echos out correctly. when I take the output and put it to the frl, the phone number is not formatted at all, just a string. i have attached one of the many tcl i have written, and the ouput!! any suggestions would be appreciated, i am ready to pull my hair out!!!

    tcl:”hsm_phone.tcl” 22 lines, 554 characters

    proc hsm_phone {} {

       upvar xlateInVals invals xlateOutVals outvals

       #

       # format telephone field (“1234567890” to “(123)456-7890”)

       #

       echo “>>> emr_phone: <$invals>“

       regsub -all — “-” $invals “” numInval

       set space  ” “

       set tele1 [crange $numInval 0 2]

       set tele2 [crange $numInval 3 5]

       set tele3 [crange $numInval 6 9]

       set xlateOutVals1 “($tele1)$space$tele2-$tele3”

      # set xlateOutVals2 “$tele2-$tele3”

      echo “xlateOutone <$xlateOutVals1>“

     # echo “xlateOuttwo <$xlateOutVals2>“

    output:

    >>>formatted_date: <01/28/1963>

    >>> emr_phone: <2123216546>

    xlateOutone <(212) 321-6546>

    >>> emr_phone: <2123216546>

    xlateOutone <(212) 321-6546>

    MESSAGE 1

        last_name: >AIGTEST                            <    first_name: >TWO                                <   middle_name: >                                   <        gender: >F<     birthdate: >01/28/1963<           ssn: >565-46-5465     <           EPN: >2506378             <       address: >230 West 245 Street                     <      address2: >305                                     <          city: >Bronx               <         state: >NY<       zipcode: >10457     <    home_phone: >2123216546          < business_phone: >(135)465-4651       <           mrn: >2506378             <  name_display: >AIGTEST, TWO

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

        Let me get on my soapbox again  ðŸ™‚

        XlateInVals and XlateOutVals are lists and should be treated as such!!

        With that said.  Try this

        # if phone number less than 10 characters, leave as is

        set inph [lindex $xlateInVals 0]  ;# Remove from list contex

        if {[string length $inph] >= 10} {

             regsub -all — {-} $inph {} inph

             regsub — {(…)(…)} $inph {(1)2-} inph

             set xlateOutVals

          }

          Make sure the FRL field receiving this is at least 13 characters wide

          Charlie

      • #56999

        Thanks Charlie, i know this was a topic in the archives, and i just could not make it work. Now it does, i thank you so much!!

        Now I am once again a happy cloverleaf analyst!!

        😆

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