File Generation / TCL Script

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf File Generation / TCL Script

  • Creator
    Topic
  • #53260
    Jon Melin
    Participant

      Hi everyone,

      I am brand new to cloverleaf and I am really enjoying what I have been able to do so far. My question is can I generate a file through a single thread that grabs a source file, runs it through a TCL script, and outputs it to another location?

      I have a TCL script that creates an unconventional style pipe delimited “HL7”  from a database report of pipe delimited values, but it is far different from what I can do with a variant because I need to add tens of pipes more than traditional messages. Running my TCL script through the testing tool seems to work fine.

      I have setup a process with fileset local and point it to the file I want it to run through my TCL script and it does consume the file but I get nothing  even when I set the outbound directory. The watch output feature on the thread shows my echos like the TCL is running but then just stops and doesn’t show any error messages. It doesn’t generate an outbound message file either so I don’t think it’s getting anywhere.

      I have the TCL applied to the inbound tab under tps inbound data. It does save my inbound messages but (I don’t know if it’s normal) they are the messages from the source file without having been run through my TCL.

      I am stuck, please provide insight if you may know.

      Thank you,

      Jon

    Viewing 4 reply threads
    • Author
      Replies
      • #77077
        Jim Kosloskey
        Participant

          Jon,

          I will assume your Tcl code is CONTINUEing the message to the engine.

          You should define another thread Fileset/Local (if this is to go to a file system local to Cloverleaf). That thread should be configured to deliver the messages you got from the inbound thread to whatever directory, etc. the messages should go.

          Then in the Inbound thread, configure Route Messages to route to your newly defined outbound thread.

          Now your Tcl proc invoked in your inbound thread will provide the messages to Cloverleaf. Cloverleaf will route the messages to the outbound thread which will place them in the directory you specify with the file name you specify.

          email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.

        • #77078
          James Cobane
          Participant

            Jon,

            Are you trying to do this with a single thread?  If so, it wouldn’t work as you need to route your messages.  I would configure 2 threads; an inbound that reads your file and applies the proc, then an outbound thread that is set to fileset-local (with the desired outbound directory and filename specified).  You should then define a raw static route from the inbound to the outbound; i.e.

            Inbound


            > Outbound

            Hope this makes sense.

            Jim Cobane

            Henry Ford Health

          • #77079
            Jon Melin
            Participant

              Thank you very much. That seemed to work. I had done this in the past but it was going to another system via TCP. I had two threads setup but I wasn’t using fileset-local on the second thread to do my output. I thought I tried that before but apparently I hadn’t done it specifically that way. I was using continue in my script when I looked back, thank you for the reminder.

              Thank you again for all the help.

              Jon

            • #77080
              Robert Kersemakers
              Participant

                You can do this with one thread as well. I do this a lot for simple ‘move’ operations where we want to keep track of all the messages through SMAT.

                Just route the messages to the same thread:

                Inbound —-> Inbound

                You will need to save the Inbound thread first, or it won’t show up in the list of threads when you want to route the messages. Use a raw, static route as described by James.

                Also take note that you can only do this with File/FileSet protocol where you can define both in- and outbound location.

                Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

              • #77081
                Jeff Dinsmore
                Participant

                  Or, if a timed cycle will do the job, you can  use a UPOC protocol, fire it every so many minutes/seconds and just write the file wherever you like from inside your TCL procedure.

                  Jeff Dinsmore
                  Chesapeake Regional Healthcare

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