Removing a }

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Removing a }

  • Creator
    Topic
  • #48607
    Jared Miller
    Participant

      I’m using the following code to remove certain characters from the patient name field:

      regsub -all {\|/|-|.|}} $xlateInVals “” xlateOutVals

      Can someone help me with the code to remove a }?  Thanks.

    Viewing 15 reply threads
    • Author
      Replies
      • #59134
        Charlie Bursell
        Participant

          You are making this more difficult than it needs to be.  Use the string map command instead.  This command accepts a list of pairs where the first character of a pair is the part to find and teh second is the replacement.

          For example

          set replList

            set str “1\2/3-4.5}6”

            set newstr [string map $replList $str]

            echo $newstr

            123456

            In most cases the string map command is much faster plus you don’t have to escape as much.

        • #59135
          Jared Miller
          Participant

            Ok, here’s what I interpreted that into and I’m getting a Tcl callout error so obviously I’ve gone wrong somewhere.  Please assist me further.  Thanks!

            proc xlt_name {} {

               upvar xlateId       xlateId

             xlateInList   xlateInList

             xlateInTypes  xlateInTypes

             xlateInVals   xlateInVals

             xlateOutList  xlateOutList

             xlateOutTypes xlateOutTypes

             xlateOutVals  xlateOutVals

                   set replList

                     set name $xlateInVals

                     set newstr [string map $replList $name]

                     

              }

          • #59136
            Charlie Bursell
            Participant

              Boy, I don’t know how many times to state that *ALL* xlate upvar variables except xlateId are *LISTS*

              I can’t tell, but I assume there are spaces between values in replList

              Also, I guess we do need to escape the } to keep Tcl from getting confused

              Works for me.

              proc xlt_name {} {

                upvar xlateId       xlateId

              xlateInList   xlateInList

              xlateInTypes  xlateInTypes

              xlateInVals   xlateInVals

              xlateOutList  xlateOutList

              xlateOutTypes xlateOutTypes

              xlateOutVals  xlateOutVals

                    set replList

                      set name [lindex $xlateInVals 0]

                      set xlateOutVals

                  ]

                         

                  }

              • #59137
                Jared Miller
                Participant

                  That did the trick for me.  Thanks for the assistance!

                • #59138
                  Joe Halbrook
                  Participant

                    I’ve tried this proc, and many variations of it, attempting to filter a single [ character (and I escaped the [ character) but the message content

                  • #59139
                    Anonymous
                    Participant

                      Joe,

                      When you escaped the [ character, did you enclose it with curly braces?

                      hcitcl>set a “123[456”

                      hcitcl>echo $a

                      123[456

                      hcitcl>regsub -all {[} $a “” b

                      1

                      hcitcl>echo $b

                      123456

                      Thanks…

                      Tom Rioux

                      The Methodist Hospital

                    • #59140
                      Joe Halbrook
                      Participant

                        Tom,

                        This is what I did:

                        proc xlt_rmvchars {} {

                      • #59141
                        Charlie Bursell
                        Participant

                          This works for me.  Give me you input string and what you are seeing for output

                        • #59142
                          Joe Halbrook
                          Participant

                            Charlie,

                            Here’s what’s going in:

                            NTE|2|RADTEST3|THIS [ WAS MEANT TO } HAVE ERRORS IN IT

                            and here’s what comes out:

                            NTE|2|RADTEST3|THIS

                          • #59143
                            Charlie Bursell
                            Participant

                              That one character comes out to be the following in hex:

                              cee1cee9 cee1

                              I don’t see this when I run it on my system.  I think you have something else going on

                            • #59144
                              Joe Halbrook
                              Participant

                                Thank you, Charlie, for taking a look at this.

                                I’ll look into this in more detail to see if there’s something else configured in this Xlate, and let you know what I find.

                              • #59145
                                Joe Halbrook
                                Participant

                                  The message leaves the sending system with a [ character in the NTE segment, but when it gets to the inbound Cloverleaf thread, it has a value of xe2 for that character.

                                  Here’s the message coming out of the sending system (all identifying data has been altered):

                                  MSH

                                • #59146
                                  Michael Hertel
                                  Participant

                                    You get this message from an sna interface, don’t you?

                                    hci_e2a and hci_a2e don’t have [ ] characters for translation.

                                    You need to fix the translations.

                                    -mh

                                  • #59147
                                    Joe Halbrook
                                    Participant

                                      Yes, it is an SNA interface.  Any suggestions?

                                    • #59148
                                      Michael Hertel
                                      Participant

                                        It’s a fairly complicated fix.

                                        The EBCDIC/ASCII map tables are in a file named hciStart.tlib

                                        Make sure if you touch this file that you back it up first.

                                        You can really muck up your system if you make a mistake.

                                        You should probably contact support.

                                        Or maybe Charlie can explain what needs to be done.

                                      • #59149
                                        Joe Halbrook
                                        Participant

                                          I think I’ll tackle this from the other side, and ask that the system sending the offending characters edit those out prior to sending to Cloverleaf.

                                          Thank you (and Charlie) for your insightful information, though.

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