building an array

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf building an array

  • Creator
    Topic
  • #49606
    John Harvey
    Participant

    Hi,

    I am working on a potential tcl script to only send adt messages for certain departments.  The thing is, there are 20+ departments for me to filter.  It seemed logical for me to build these departments into an array at startup, then have the array available during runtime.

    As I understand TCL within Quovadx, I believe I would need to build the array into one tcl script (as I have posted below), then I would need to add the one script to both the start-up procedures field within the Protocol Properties, AND to the TPS Outbound Data field under the outbound tab.

    Am I pretty close on my reasoning?

    ######################################################################

    # Name: filter_hl7_dpt

    # Purpose: to filter by department.

    #        

    # UPoC type: tps

    # Args: tps keyedlist containing the following keys:

    #       MODE    run mode (“start”, “run” or “time”)

    #       MSGID   message handle

    #       ARGS    user-supplied arguments:

    #              

    #

    # Returns: tps disposition list:

    #          

    #

    proc filter_hl7_dpt { 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

               build the array here

           }

           run {

               # ‘run’ mode always has a MSGID; fetch and process it

               Filter message here using the array

           }

           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

    }

Viewing 1 reply thread
  • Author
    Replies
    • #62718
      Robert Milfajt
      Participant

      Can you use a Cloverleaf table to hold the contents of your array?  Then all you need to do is a table lookup when you need to access it.

      Hope this helps,

      Robert Milfajt
      Northwestern Medicine
      Chicago, IL

    • #62719
      John Hamilton
      Participant

      Your logic will work.  But I agree with John why not just build a table and use that. This would make it more easy to maintain. Also makes it easier for other to look at and understand.

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

Forum Statistics

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