Setting up the Test Case File

To set up the test conversion take the following steps:

  1. Select File | New | Test Case File | OnHL7Convert to get a screen as follows:

    Screen Shot

  2. Copy the following text line and paste it into the "Event Information" window.
       1,123456,Smith,John,Peter,12/03/1956,M,1 Nowhere Street,,Nowhereville,MN,1234,03/04/1996,PU
      
  3. Select File | Save As... | Convert6 (Note: Save all files in the HL7Tutorial folder c:\HL7Tutorial) to get a screen as follows:

    Screen Shot

Setting up the Conversion Script

The script is presented an event with the following properties:

Property    Details
RawLine    The raw text record
Fields    A list of fields generated from the file. Either comma or TAB delimited, which one of these is automatically determined.
Msg    The HL7 message that needs to be populated.The Message is empty.

Since our file is comma delimited, we can use the "Fields" list to get the contents of the text record.

The first thing to do is assemble the base message and set it correctly. We need to set the version, the event type, the message type, and the MsgID, and then create the segments required.

To setup the conversion script carry out the following steps:

  1. Select File | New | VBScript(.vbs) OR Javascript(.js)
  2. Copy the following script and paste it into the script file:

    Language    Script
    VBScript   
          function Convert(aEvent)
            set m = aEvent.Msg
            m.Version = "2.3.1"
            m.Event = "A08"
            m.MessageType = "ADT"
            m.MsgID = "testid"
            m.AddMSHForBuild
            m.AddSegment("EVN")
            m.AddSegment("PID")
            m.AddSegment("PV1")
          end function
         
    Javascript   
          function Convert(Event){
            var m; // message
            m = Event.Msg;
            m.Version = '2.3.1';
            m.Event = 'A08';
            m.MessageType = 'ADT';
            m.MsgID = 'testid';
            m.AddMSHForBuild;
            m.AddSegment('EVN');
            m.AddSegment('PID');
            m.AddSegment('PV1');
           };
         

  3. Select File | Save As... | Convert6.vbs OR Convert6.js to get a screen similar to the following:

    Screen Shot

Running the Conversion

To run the conversion take the following steps:

  1. In the Test Case File "Convert6.tci" setup the script and the procedure as shown in the screen below:

    Screen Shot

  2. Click on Go and you should get a screen as follows:

    Screen Shot


© Kestral Computing P/L 2000-2010.