adding 6 OBX segments to the end of a message

Homepage Clovertech Forums Read Only Archives Cloverleaf Tcl Library adding 6 OBX segments to the end of a message

  • Creator
  • #51229
    Josh Fishel

    Is it possible to add 6 additional OBX segments to the end of an ORU message?  If so would someone be able to point me in the right direction?



Viewing 6 reply threads
  • Author
    • #69289
      David Barr

      Cloverleaf lets you handle HL7 messages as strings in TCL, so you can use something as simple as the TCL “append” command to add segments to a message.  It is more common to split the message into a list of one string per segment (using the split command), use list commands to add the segments (linsert, lappend), and join the segments back into message with the join command.

    • #69290
      Josh Fishel

      would you be able to give me a quick example?

    • #69291
      David Barr


      set msg [msgget $mh]
      for { set i 1 } { $i <= 6 } { incr i } {
       append msg "OBX|$i|new obx goes herer"
      msgset $mh $msg
      lappend dispList "CONTINUE $mh"

      The normal way to do this would be to use the Cloverleaf code editor to create a new file. Then you insert the TPS template.  Then you add the code above to your new file (in the “run” section).  Then you use the NetConfig tool to configure your thread to call the new TPS proc.

      If you haven’t done any of this before, you will probably need some training, either from Healthvision or from a co-worker.

      If you have done parts of this but are having difficulty with one particular step, please be more specific about your problem.

    • #69292
      Josh Fishel

      I am new to cloverleaf, and tcl.  i have written a few tcl procs but not that many. The ones i have written were simple and just did a quick replace.  I just could not figure out how to add these 6 additional OBX records.

      Thank you very much for your help.

    • #69293
      Jim Kosloskey

      This can also be done in the Xlate without Tcl I think.


    • #69294
      Chris Williams


      Be aware that you will want the OBX-1 value to be sequential relative to the existing OBXs you’re starting with. The first segment you are appending needs to have the value of the previous OBX-1 plus 1 rather than just starting out at 1.

    • #69295
      Josh Fishel

      what i needed to do was to add the 6 additional OBX segments  starting at OBX|994 to OBX|996.  So i just used David’s code from above and set i to 994 i<=999.  Then modified the inside of the loop to accommodate what i need done….

      I can post my code if that will help….

Viewing 6 reply threads
  • The forum ‘Tcl Library’ is closed to new topics and replies.

Forum Statistics

Registered Users
Topic Tags