Using hcitpstest to test new proc

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Using hcitpstest to test new proc

  • Creator
    Topic
  • #49212
    Gary Atkinson
    Participant

      Hello-

      I have very new to Tcl and how it interacts with Cloverleaf.  When I test a proc I wrote to remove any “newlines” within the HL7 message I receive the following error when using hcitpstest:

      Code:


      “can’t read “mode”: no such variable
        while executing
      “switch -exact — $mode {
                 start {
      invoked from within
      “remove_illegal_chars { MSGID message 0 } { DISP CONTINUE } { ARGS {} }”

      My code is here:

      Code:

      proc remove_illegal_chars { args } {
         keylget args MODE mode               ;# Fetch mode

         set dispList {} ;# Nothing to return

         switch -exact — $mode {
             start {
                 # Perform special init functions
         # N.B.: there may or may not be a MSGID key in args
             }

             run {
         # ‘run’ mode always has a MSGID; fetch and process it  
                 keylget args MSGID mh
                 set msg [msgget $mh]
                 regsub -all n $msg { } msg
                 msgset $mh $msg
                 lappend dispList “CONTINUE $mh”
             }

             time {
                 # Timer-based processing
         # N.B.: there may or may not be a MSGID key in args
             }
             
             shutdown {
         # Doing some clean-up work
      }
         }

         return $dispList
      }


      First then I noticed is that MODE is not being passed in as argument.  I am using the testing tool incorrectly?

    Viewing 4 reply threads
    • Author
      Replies
      • #61114
        Michael Hertel
        Participant

          You probably selected “other” when you created this tclproc.

          Then you cut n pasted from another proc.

          You need to select “tps” to set up the correct housekeeping.

          Then do your cut n paste.

        • #61115
          Gary Atkinson
          Participant

            When I created the proc I choose “tps” from the script editor.  What I did do was copy the “template” to textpad and wrote the code in there.  Could that have caused an issue?

          • #61116
            Michael Hertel
            Participant

              Actually, ignore what I said before.

              You are using the testing tool wrong.

              The proc name goes in the procs box at the top of the tool.

              The “Send to proc” box under save options should be valued with hcitpstestshowbydisp.

              -mh

            • #61117
              Gary Atkinson
              Participant

                That was it!  Sorry first time I used tool, but looking at it now that makes logical sense.  Thank you very much Michael8)

              • #61118
                Michael Hertel
                Participant

                  You’re welcome. Good luck in your new tcl adventure!

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