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.
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.
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.
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.
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….
Author
Replies
Viewing 6 reply threads
The forum ‘Tcl Library’ is closed to new topics and replies.