Xlate TCL Proc

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Xlate TCL Proc

  • Creator
    Topic
  • #48995
    Ricci Graham
    Participant

      I am trying reformat a date in a “COPY” inside the XLATE with a Post TCL proc. If I were going to do this on the outbound thread with a TCL Proc, I would do  something like:

      set dt [lindex $HDRFlds 3]

      set dt [clock format [clock scan $dt] -format “%m%d%Y”]

      set HDRFlds [lreplace $HDRFlds 3 3 $dt]

      I know how to “get hold” of the “date” in this environment with the “lindex”, but I am not quite sure how to “get hold” of the date in the environment inside the COPY inside the XLATE? If the COPY inside the XLATE looks like:

      0(0).MSH.00007            0(0).HDR.90001

      and I want to do the reformating on the destination, then I thought I would have done:

      set dt 0(0).HDR.90001

      but that didn’t work.

      Can someone give me some guidance here?

      The reason I need to do the formatting here is because I will be taking multiple individual records  and reformatting them all and putting them into on batch file, stripping off the MSH segments, adding one HDR (header) record at the beginning of the batch and one EOF at the end of the batch. So I want to do the reformatting of the dates inside the XLATE and then put one Header record on the front of the file and the EOF on the end of the file on the Outbound thread and send it on.

      Does that sound about righ?

      Any suggestions or help would be appreciated!!!

      Thanks,

      Ricci

    Viewing 2 reply threads
    • Author
      Replies
      • #60357
        Robert Kersemakers
        Participant

          Hi Ricci,

          If you’re using a tcl-proc within a translation, your input variables will be available in a list: xlateInVals. Similarly, the result should also be returned inside a list: xlateOutVals.

          So if you have the following COPY

          0(0).MSH.00007 -> 0(0).HDR.90001

          your Pre (!) tcl-code will look like this:

          Code:

          lassign $xlateInVals dt
          set dt [clock format [clock scan $dt] -format “%m%d%Y”]
          set xlateOutVals [list $dt]

          By the way, I almost always use tcl-code in Pre-translation…

          Hope this helps!

          Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

        • #60358
          Ricci Graham
          Participant

            Thanks Robert,

            Let me give this a try,  I’ll let you know how it comes out.

            Ricci

          • #60359
            Ricci Graham
            Participant

              Robert,

              This ended up working great. Thanks so much for the help.

              Ricci

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