Error on determing trxid

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Error on determing trxid

  • Creator
    Topic
  • #53464
    David Speare
    Participant

      Hello –

      I am trying to use the below code to determine what my route pattern will be for the inbound ORM messages.  The code is making the correct trxid determination, but it is not being returned out to the thread.

      Error Message:

      No_Harvest

      [tps :tps :ERR /0:  fr_Epic_ORM:01/10/2013 13:20:45] ‘No_Harvest’ (returned by ‘tps_Test_ ‘) does not match { }

      Yes_Harvest

      [tps :tps :ERR /0:  fr_Epic_ORM:01/10/2013 13:20:45] ‘Yes_Harvest’ (returned by ‘tps_Test_ ‘) does not match { }

      Code:



      proc tps_Test_ {args} {
      keylget args MODE mode
      set trxid {}

      # Get the message id
      set inMH [keylget args MSGID]

      #this is the message
      set data   [split [string trimright [msgget $inMH] r] r]

      # for each line in the message
      foreach segment $data {

      # determine what segment this is
      set hdr [crange $segment 0 2]

      # if we found an obr segment, this is what we want
      # handle it
      if {$hdr == “OBR”} {

      # split the fields base on the standard delimiter
      # and identify the field that we are looking for
      set fields [split $segment |]
      set obr4 [lindex $fields 4]

      # check if the word “harvest” (regarless of case)
      # is in the field.
      set is_harvest [regexp -nocase harvest $obr4]

      # set the out trxid based on the findings
      if {$is_harvest == 1} {
      echo Yes_Harvest
      set trxid “Yes_Harvest”
      } else {
      echo No_Harvest
      set trxid “No_Harvest”
      }
      }
      }
      return $trxid
      }

    Viewing 4 reply threads
    • Author
      Replies
      • #77765
        Jerry Tilsley
        Participant

          To test a trxid you need to assign it to a route then do a route test.  You cannot use the TPS test tool as this expects to have a key value list for message dispositions.  If you want send me a private message and I can try to walk you through testing the trxid.

        • #77766
          James Cobane
          Participant

            David,

            Is this proc configured in the TRXID context (i.e. ‘Trx id determination Format’ set to UPOC with this proc employed)?  From the log, it looks like it may be configured as an inbound TPS, rather than a TrxID proc….

            Jim Cobane

            Henry Ford Health

          • #77767
            David Speare
            Participant

              Thanks guys – I was not setting the correct trxid type….that was silly.

              Now I am getting this error:

              [xlt :rout:ERR /0:Harvest_xlate:01/10/2013 15:22:23] TrxId determination via Tcl failed: keyed list entry must be a valid, 2 element list, got “message0” , args()

              [xlt :rout:ERR /0:Harvest_xlate:01/10/2013 15:22:24] TrxId determination via Tcl failed: keyed list entry must be a valid, 2 element list, got “message0” , args()

            • #77768
              Tom Rioux
              Participant

                Now that you have your trxid upoc in the correct place, change the “args” to “mh”

                {args} –> {mh}

                Tom Rioux

              • #77769
                David Speare
                Participant

                  Thank you so much.  I changed the inbound variable {args} to {mh}.  I also modified my it to not worry about the keylget.  Is that bad? the results are what i wanted.

                  Code:



                  proc tps_Test_ {mh} {
                  # keylget mh MODE mode
                  set trxid {}
                  echo $mh
                  # Get the message id
                  # set inMH [keylget mh MSGID]
                  set inMH $mh
                  #this is the message
                  set data   [split [string trimright [msgget $inMH] r] r]

                  # for each line in the message
                  foreach segment $data {

                  # determine what segment this is
                  #set hdr [crange $segment 0 2]
                  set hdr [string range $segment 0 2]

                  # if we found an obr segment, this is what we want
                  # handle it
                  if {$hdr == “OBR”} {

                  # split the fields base on the standard delimiter
                  # and identify the field that we are looking for
                  set fields [split $segment |]
                  set obr4 [lindex $fields 4]

                  # check if the word “harvest” (regarless of case)
                  # is in the field.
                  set is_harvest [regexp -nocase harvest $obr4]

                  # set the out trxid based on the findings
                  if {$is_harvest == 1} {
                  echo Yes_Harvest
                  set trxid “Yes_Harvest”
                  } else {
                  echo No_Harvest
                  set trxid “No_Harvest”
                  }
                  }
                  }
                  return $trxid
                  }

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