Rebuild message

  • Creator
    Topic
  • #50461
    Rick Pritchett
    Participant

    I am getting a error code 307.  Here is a code snippet where is split  insert a new field and rebuild a message.  Is there something i am doing that might cause this?

    set ORM_segList [split $ORM_MSG r]       ;#  Create segment list using carriage return.

    set ORM_PID_Seg [lindex [lregexp $ORM_segList {^PID}] 0]  ;#  Find PID segment.

    set ORM_PID_fields [split $ORM_PID_Seg $Fld_Sep]  ;#  Split PID segment up into fields.

    set newPid [lreplace $ORM_PID_fields 2 2 $ADT_mrn] ; # Replace old MRN with new one.

    set newPid [join $newPid $Fld_Sep] ; # Put segments back together.

    set ORM_segList [lreplace $ORM_segList 2 2 $newPid] ;# Group the segment list back together.

    set new_ORM_Msg [join $ORM_segList r] ;# Put r carriage return back into msg.

Viewing 5 reply threads
  • Author
    Replies
    • #66189
      Tom Rioux
      Participant

      This snippet of code seems to be working fine.  I guess the issue is coming from another area in your code.  

      Tom

    • #66190
      Rick Pritchett
      Participant

      Ok here is the entire proc i thought it was the way i was rebuilding the message the only other thing i can think of now is how i am returning it to the engine.

      proc tps_sqlite_test { args } {

      package require sqlite

      set dbName “/quovadx/qdx5.4/integrator/sqlite_db/sample1.db3”

      #sqlite DBCMD $dbName

      keylget args MODE mode

    • #66191
      John Mercogliano
      Participant

      I don’t know if this is the problem but one potential problem I see is this statement

      Code:


      set ORM_segList [lreplace $ORM_segList 2 2 $newPid] ;# Group the segment list back together.


      You are assuming that the PID segment will always be the 3rd list element when in fact it could be the 2nd or 3rd.  An ORM does not usually have an EVN segment before the PID but it can have an optional NTE segment. Your sending system may vary 🙂

      You potentially could be replace the PV1 segment with the PID and having two PID segments in the message.  

      You might want to use lsearch to get the PID instead of lregexp as lsearch returns the index location.  

      Hope this helps

      John Mercogliano
      Sentara Healthcare
      Hampton Roads, VA

    • #66192
      Tom Rioux
      Participant

      Rickey,

      Just one quick question.  It is Friday and maybe I’m missing something but what are you doing with the disposition of the original ADT message?  I see where you are setting the ORM message to $mh.  What happens now to the msg handle for the ADT?  Shouldn’t you be using the dispList and do something like:

      lappend dispList “{CONTINUE $mh}”  (for the ADT)

      msgset $nmh $new_ORM_Msg

      lappend dispList “{CONTINUE $nmh}” (for the ORM}

      return $dispList

      Just a thought…..like I said…it is getting late on a Friday.

      Tom Rioux

    • #66193
      John Mercogliano
      Participant

      Rickey,

       Interesting code. Based on the code it looks like you are receiving an  ADT message, looking up a ORM message in your database and replacing the ADT message with the ORM.

       Are you doing this in the inbound, xlate proc, or outbound connection.  Because your are completely changing the message it might be better to create a new message handle and explicitly kill the adt and continue the ORM.  You might be messing up the route determination especially if you are doing this in the pre xlate proc.

      Good luck,

      John Mercogliano
      Sentara Healthcare
      Hampton Roads, VA

    • #66194
      Rick Pritchett
      Participant

      John,

      I believe you are right i was trying to use them in the prexlate.

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

Forum Statistics

Registered Users
5,125
Forums
28
Topics
9,294
Replies
34,439
Topic Tags
287
Empty Topic Tags
10