Inserting an HL7 message example

This is an example of inserting an HL7 message and its patient ID into Table2’s columns Hl7content and patientID.

  1. Create Table2, including the columns patientID and Hl7content, where patientID is the primary key.
  2. Click the Table Schema button and import Table2 for the Database Outbound protocol.
  3. Write a Tcl script to generate a new message:
    $patientID $fieldSeparator $originalMessage
    • $patientID is retrieving from the $originalMessage.
    • $fieldSeparator is the field separator defined in Table Schema format. Field separators can conflict with the message content, so you can set an appropriate field separator in Table Schema to avoid conflicts.
    • $originalMessage is the raw message.
  4. Apply the Tcl script to the pre-outbound TPS.
  5. Run insert sql statement:
    INSERT INTO Table2(Table2.patientID, Table2.Hl7content)
    VALUES (Table2.patientID,Table2.Hl7content)   
  6. Run update sql statement:
    UPDATE Table2 set Table2.Hl7content=Table2.Hl7content
    WHERE Table2.patientID=Table2.patientID