Messages not routing with proc in place

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Messages not routing with proc in place

  • Creator
    Topic
  • #50358
    Scott Smith
    Participant

    I am using 5.6 on AIX.

Viewing 7 reply threads
  • Author
    Replies
    • #65743
      Bob Richardson
      Participant

      Greetings,

      I do not see any return of your dispList list of message handles.

      There is a commented out line – part of your debug?

      Anyway, a good coding practice is to set the dispList variable to null

      at the top of your proc and return its contents just before the last line

      in your proc.  If you don’t return this list of message dispositions you get leaky handles and of course the engine doesn’t know what to do with these messages.

      In running the tester always check the “leak detection” box – a good habit to get into for testing tcl, xlates, whatever.  By running your code you should see leaking handles warning messages idisplayed by the tester.

    • #65744
      Scott Smith
      Participant

      Thanks Bob.

      I fixed that error, now I getting

      [0:TEST] ‘CONTINUE’ (returned by ‘tpsfilterdoccw_tbl ‘) does not match { }

      [0:TEST] ‘message0’ (returned by ‘tpsfilterdoccw_tbl ‘) does not match { }

      I don’t think I have seen this one before, do you know what it means?

    • #65745
      Bob Richardson
      Participant

      Scott,

           You need to change the “set” command to “lappend” for your

      variable dispList.  The engine expects a list of “disposition message handle”.

            This will fix the problem.

            Enjoy.

            BobR

    • #65746
      Scott Smith
      Participant

      Bob,

      It  must be one of those weeks.  I changed both “sets” to lappend and now I get the “bogus msgStrId…: error.  

      Could it have something to with that I am killing the message by default and if it is found in table to continue the msg?

    • #65747
      Bob Richardson
      Participant

      Scott,

      If you are killing the message by default, you need to unset the dispList

      variable and reset it to your continue dispostion.  Yes, if you killed the message first then you cannot continue it.

      Logic like so:

      set dispList {}  ;#create and initialize to the empy set

      run {   lappend dispList “KILL $mh”  ;#default disposition

               

               (after some logic you decide to continue this message)

                unset dispList

                lappend dispList “CONTINUE $mh”

      [before exiting proc]

               return $dispList

      Check the flow of control in your procedure – desk check – run a message through the logic manually and see what happens to it.

      I hope this proves useful for you.

      BobR

    • #65748
      Michael Hertel
      Participant

      Scott, can I make two suggestions?

      1) Forget about using dispList

      2) As you step thru the proc and you know you want to kill the message, return a kill there, otherwise let the message fall thru the rest of the logic and end with a continue.

      Code:

      proc tpsfilterdoccw_tbl { args } {

        keylget args MODE mode              ;# What mode are we in
       
        switch -exact — $mode {
            start {
      return “” ;# Perform special init functions
            }

            run {
      keylget args MSGID mh

      set msg [msgget $mh]

      set fieldSeparator [crange $msg 3 3]

      set OBRsegment [getHL7Segment $msg OBR]

      set drNumber [lindex [split [getHL7Field $OBRsegment 16 $fieldSeparator] ^] 0]
        set drNumber [crange $drNumber 0 3]

      if {[cequal [tbllookup tblphysicians_cw $drNumber] KILL]} {
      return “{KILL $mh}”
      }

      shutdown {
      # Doing some clean-up work
      }

      default {
      error “Unknown mode ‘$mode’ in tpsfilterdoccw_tbl”
      return “”                   ;# Dont know what to do
      }
        }

        return “{CONTINUE $mh}”

      }

    • #65749
      Scott Smith
      Participant

      Mike,

      I like those.  I was trying to use a already proc and modify it.  That looks much better.

      And Bob thanks for the debugging help – I finally got it going.

    • #65750
      Tom Rioux
      Participant

      One thing I would suggest with Michael’s code is to get rid of the “getHL7Segment” commands.  As Charlies always preaches, stay away from looping, which is what I believe this command does.  Replace it with an “lsearch” command.  You should be able to find many good examples on here of how to use this command.

      Thanks…

      Tom Rioux

      Baylor Health Care

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

Forum Statistics

Registered Users
5,042
Forums
28
Topics
9,200
Replies
34,023
Topic Tags
267