Removing Spaces

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Removing Spaces

  • Creator
    Topic
  • #53527
    Jon Melin
    Participant

      Hello, and thank you in advance.

      I have an inbound message that contains a random space (I don’t want to assume the same sub field each time) and I am trying to remove it through my XLATE. I am sure I could use regsub but I am using a pathcopy (cant add pre-tcl) so I am trying to avoid splitting each copy out. I will if I have to but attached is a picture of my XLATE and the inbound message. I cannot get the space cleared. Any thoughts?

      Thank you!

      Jon

    Viewing 3 reply threads
    • Author
      Replies
      • #77995
        Robert Milfajt
        Participant

          If you’re going to iterate over OBR-28 anyway to check for space, might as well deep six the PATHCOPY OBR-28->TXA-23 and just iterate over OBR-28 and copy each iteration one at a time, then use TCL code to regsub any random ” ” arguments.

          Something like COPY 0(0).OBR(0).#28(%f1) -> 0(0).TXA(0).#23(%f1) with TCL.

          Code:

          set xlateOutVals “”
          foreach obr_28_field $xlateInVals {
          regsub {^ $} $obr_28_field {} txa_23_field
          lappend xlateOutVals $txa_23_field
          }

          Not sure if this will work, but worth a shot, no?

          Robert Milfajt
          Northwestern Medicine
          Chicago, IL

        • #77996
          Tom Rioux
          Participant

            Here is something that may work so you don’t have to loop through the fields:

            First, copy your OBX.28 to your TXA.23

            Second, create a new copy action using the new outbound value of TXA.23 as your source value:

                ~TXA.23 –> TXA.23

            Third, have the following pre-tcl proc:

            set inlist $xlateInVals

            set ix [lsearch -regexp $alist {^ $}]

            if {$ix >=0} {

               set xlateOutVals [lreplace $alist $ix $ix “”]

            }

          • #77997
            Chris Williams
            Participant

              Using [string trimright …] if you’re copying the individual components might be less complex while also catching situations where there are multiple spaces.

            • #77998
              Jon Melin
              Participant

                Thank you all for the suggestions! It was very helpful.

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