Accessing message from within xlate

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Accessing message from within xlate

  • Creator
    Topic
  • #50658
    Sergey Sevastyanov
    Participant

      Hi

      Is there a way to access message from within translation?

      I am filtering messages depending on a value in TXA-2.

      I’d like to output message text in the log if it gets SUPPRESSed.

      I don’t want to filter in pre-xlate Tcl UPoC (I know how to get message from there).

      So, now filtering part of translation looks like that:

      Code:


      { { OP COMMENT }
         { COMMENT {Kill if TXA-2 is not OP01, OP11, DS02 or DS22} }
      }
      { { OP IF }
         { ERR 0 }
         { COND { (0(0).TXA.#2  ne =OP01) && (0(0).TXA.#2 ne =OP11) && (0(0).TXA.#2 ne =DS02) && (0(0).TXA.#2 ne =DS22)} }
         { THENBODY {
             { { OP COPY }
                 { ERR 0 }
                 { PRE {
                     echo “message suppressed; type [lindex $xlateOutVals 0] is neither of the following: OP01/OP11/DS02/DS22”
                 }}
                 { IN 0(0).TXA.#2 }
                 { OUT @null }
             }
             { { OP SUPPRESS } }
         }}
         { ELSEBODY {
         }}
      }

      Thanks

      Sergey

    Viewing 4 reply threads
    • Author
      Replies
      • #67015

        I’m not sure I understand your question? Can you provide more detail, please?

        -- Max Drown (Infor)

      • #67016

        If you want to include fields from the message in your output to the log, then you add the fields to the inbound side like normal and then use [lindex $xlateInVals 0], [lindex $xlateInVals 1], etc. to get them in your tcl fragment.

        Example: { IN {{=message (} {0(0).MSH.00010.[0]} {=) suppressed for missing PID3}} }

        -- Max Drown (Infor)

      • #67017
        Sergey Sevastyanov
        Participant

          Max,

          Quote:


          If you want to include fields from the message in your output to the log, then you add the fields to the inbound side like normal and then use [lindex $xlateInVals 0], [lindex $xlateInVals 1], etc. to get them in your tcl fragment.

          That is what I am doing in the fragment that I showed – I pass TXA-2 to use it in echo.

          What I am asking if i could pass the whole text of the message rather than one or more fields. So in the inbound part I would have something like @message (of course there is no such built-in variable). Then in my Tcl fragment I’d have:

          Code:


          echo “Message [lindex $xlateOutVals 0] was suppressed…”

          Or if I could get message id in my fragment I could use msgget to get message text and then output it

          Thanks

        • #67018

          Good question, but I don’t know the answer. If it was me, I’d do it in a pre-proc.

          -- Max Drown (Infor)

        • #67019
          John Mercogliano
          Participant

            What I have done, is in an inbound proc I write the message text into the user metadata using msgmetaset, then from within the xlate you can pull the message text back out using xpmmetaget as needed.

            Hope this helps,

            John Mercogliano
            Sentara Healthcare
            Hampton Roads, VA

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