Field Edit

  • Creator
    Topic
  • #48111
    Jared Miller
    Participant

      Looking for a bit of help in character removal from the Name field.  Would like to be able to remove all / . and – from that field.

      I am currently using the following on TE-ST;BABY;1 BOY:

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

      The problem is that it outputs TEST only so the first and middle names are gone.  What am I doing wrong??

    Viewing 3 reply threads
    • Author
      Replies
      • #57674
        James Cobane
        Participant

          Jared,

          Make sure that you are treating xlateInVals and xlateOutVals as lists in your code:

          set name [lindex $xlateInVals 0]

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

          set xlateOutVals

            Hope this helps.

            Jim Cobane

            Henry Ford Health

        • #57675
          Jared Miller
          Participant

            Here’s what I have…..

                   set xlateOutVals “”

                   set name $xlateInVals

                   set name [lindex $xlateInVals 0]

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

                   set xlateOutVals

          • #57676
            Anonymous
            Participant

              Jared,

              When you use the field reference of a field that has subfields as the source of a translation action, the engine creates a list of all the subfields to put into xlateInVals.  So, the name field doesn’t contain “name;name;name” it contains “name name name”.  You can actually simplify your code to accomodate by not doing the lindex or passing the field back as a list.

              Try this line only:

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

            • #57677
              Jared Miller
              Participant

                Ah, that makes sense Greg.  That worked for me perfectly.  

                Thank you both for your assistance.

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