Xlate & Regex – Stumped

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Xlate & Regex – Stumped

  • Creator
    Topic
  • #52284
    Femina Jaffer
    Participant

      Hello,

      I am in a dilemma here and just don’t understand this.  I wrote a code snippet in an xlate for PID 5.  I needed to look for last name in the xlateinvals and ONLY if there is a hyphen, I need to remove any spaces before or after the hyphen.  When I test this in the tester it works fine; however, when I run it thru the interface it is removing the hyphen instead!  Please advise??/

      Here is the script:

      proc xlt_pid5_remove_space {} {

         upvar xlateId       xlateId

       # xlateInList   xlateInList

       # xlateInTypes  xlateInTypes

        xlateInVals   xlateInVals

       # xlateOutList  xlateOutList

       # xlateOutTypes xlateOutTypes

        xlateOutVals  xlateOutVals

              set xlateOutVals “”

              set name xlateInVals

              set name [lindex $xlateInVals 0]

              if {[regexp — {-} $name]} {

                  regsub -all {s?} $name {} name

                  set xlateOutVals

                      echo remove hypthens $name

                          }

               set xlateOutVals

        }

    Viewing 4 reply threads
    • Author
      Replies
      • #73685
        Jim Kosloskey
        Participant

          Femina,

          I suspect the way you are getting xlateInVals and xlateOutVals is flawed.

          xlateInVals and xlateOutVals are lists and if you don’t treat them as a list you will not get or put all of the data you expect if the data contains white space (a space is white space).

          Try using list commands when referencing these.

          email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

        • #73686
          Femina Jaffer
          Participant

            David,

            I am not following you.  Please explain.

          • #73687
            Femina Jaffer
            Participant

              Sorry I meant Jim.

            • #73688
              Femina Jaffer
              Participant

                NEVER MIND.  I figured this out;  apparently, there was another code on the outbound thread that was doing the opposite – it was removing the hyphen.  Anyway, after removing that it worked just fine.

                Thanks!

                Femina

              • #73689
                Jim Kosloskey
                Participant

                  Femina,

                  Sorry I mis-read your code. It appears you are treating the lists as lists. 😳

                  email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

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