Xlate pre proc code?

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Xlate pre proc code?

  • Creator
    Topic
  • #48840
    Mark Perschbacher
    Participant

      Can anyone tell me why this code when used as a pre-proc in an xlate will work for everything but ~’s?

      set code [lindex $xlateInVals 0]

      set xlateOutVals

        ]

      Viewing 3 reply threads
      • Author
        Replies
        • #59862
          Ed Mastascusa
          Participant

            If ~ is one of your HL7 delimiters,

            echoing $code will probably show that the 0th element of your xlateInVals list is going to be everything to the left of the (first) ‘~’. The delmiiters will split your xlateInVals list and won’t actually show up in the xlateInVals list elements.

            The only way I know to remove unwanted delimiters is in a tps proc, not an xlt proc.

          • #59863
            Mark Perschbacher
            Participant

              Ed, yes ~’s are the delimiter our lab system uses to indicate new line.  So if I create a proc that is called within an xlate, should that work?

            • #59864
              Ed Mastascusa
              Participant

                Mark,

                If you know that you only have “~”s in the data at the front end of the copy you could do somthing like this inside the xlt proc. This fails if there are ^s or &s spiltting up the incoming list.

                set outVal “”

                foreach val $xlateInVals {

                  append outVal $val “~”

                }

                set outVal [ string trimright $outVal ~ ]   ;# remove trailing  s or ~s

                set xlateOutVals [ list  [string map “~ { }” $outVal ] ]

                depending on what you are trying to do, a pre/post tps proc may be more straightforward – that’s where we invariably do this sort of scrubbing when the data isn’t quite HL7.

              • #59865
                Mark Perschbacher
                Participant

                  Ed, I went ahead and inserted it as an xlate CALL, and it worked.  The only problem is since the ~’s are deliminters, when the xlate converts the proc output back to the outval, it still inserts the ~’s.  I am thinking that running a similar proc on the thread after it is xlated might be the way to go.  I am also testing another proc I pulled from Clovertech that truncates the OBX-5 if it is greater than 68 characters, but can’t get it to work.  The proc runs fine, it just doesn’t truncate.  Do you have time to take a look at it?

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