Sterling Jones

Forum Replies Created

Viewing 3 replies – 1 through 3 (of 3 total)
  • Author
    Replies
  • in reply to: Iterate through list of until record is null? #86364
    Sterling Jones
    Participant

      Big thank you, Jim. I changed the iterate to segment from list (%s1 as variable now), updated all references to the old %l1 variable, and made the HRL the basis. Changed the HRL itself to repeat up to 2000 times, and may go more after an analysis of past files. Simple fix. Thanks!

      in reply to: Is it possible to have multiple OBDIRs in a TCL proc? #85803
      Sterling Jones
      Participant

        Keith McLeod wrote:

        You could create a new handle and associate different metadata with it before appending to your dispList.

        Take a look at hl7Raw_ack.tcl located in $HCIROOT/tclprocs for an idea of what you can do….

        set obMsg [msgcreate -type reply] You probably want -type data

        Set new metadata for DRIVERCTL

        return “{CONTINUE $mh} {CONTINUE $obMsg}”

        Not tested but should give you some direction.

        Hi Keith, THANK YOU. This was a great help in pointing me in the right direction. I played with a couple of options, but ultimately found what works. It may not be the most efficient, but I learned a couple of things (these may be common knowledge, but I didn’t know as a relative beginner):

        * msgcreate created a blank, empty message. While this did create a new skeleton message (message1), it didn’t have any data in it, which led me to…

        * msgcopy worked for what I needed. It made message1 (obMsg) with data from message0 (mh).

        I still followed what you said in regards to message creation and defining specific metadata for its DRIVERCTL. Here is my final code (improvement suggestions are welcome):

        run {

        in reply to: TCL proc to read specific file names? #85778
        Sterling Jones
        Participant

          Hi Raj,

          What I have configured is I wrote a simple TCL script like this:

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

          proc ftp_dir_parse_pattern_[SOMETHING HERE]_ib { args } {

             global HciConnName HciSiteDir

             set module “ftp_dir_parse_pattern/$HciConnName”

             keylget args MODE mode

             set dispList {}

             switch -exact — $mode {

                 start {}

                 run {

                     

                     set uargs {}; keylget args ARGS uargs

                     set debug 1

                     set today [clock format [clock seconds] -format {%Y%m%d}]

                     set pattern “Patient_$today.txt”

                     catch {keylget uargs PATTERN pattern}

                     set outList {}

                     set dispList {}

                     if {$debug} {puts “DEBUG: $module: pattern: $pattern”}

                     

                     keylget args MSGID mh

                     set fileList [msgget $mh]

                     set outList {}

                         

                     foreach fileName $fileList {

                         if {[regexp $pattern $fileName]} {

                             #echo ” FOUND A FILE”

                             if {$debug} {puts “DEBUG: $module: fileName: $fileName”}

                             lappend outList $fileName

                         }

                     }

                     if {$debug} {puts “DEBUG: $module: outList: $outList”}

                     msgset $mh $outList

                     lappend dispList “CONTINUE $mh”

                 }

                 time {

                      echo ” ################## IN PROC:  TIME MODE ###############################”

                     }

                 shutdown {}

                 default {}

             }

             return $dispList

          }

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

          Then, put the newly created tcl in the “Directory Parse:” section of the TPS in the Inbound area. Hope this helps

        Viewing 3 replies – 1 through 3 (of 3 total)