CreateFromHL7() |
Top Previous Next |
Object: EHL7.EHL7Message FileName: EHL7.dll
METHOD
Name: CreateFromHL7() Parameters: strHL7 (String) A single complete HL7 message in string format. Returns: Boolean Description: This method will populate the current message from an HL7 message string
Programming Note: You must have called either InitializeVendor() or SetVendorObject() before you can use this method. The HL7 message passed in strHL7 must use the field delimiters defined in the vendor object, with the same encoding characters (refer to HL7 documentation for rules on HL7 field delimiters and encoding characters) OR if the encoding characters are not the same as those in the vendor object they will be dynamically converted as the message is loaded (see below). The segment (record) delimiter in the HL7 Message MUST be the same as the SegmentDelimiter Property of the HL7Vendors object . The message string must contain only one HL7 message.
Example: Private Sub MessageTest() Dim myVendorObj As New EHL7.HL7Vendors Dim myMsg As New EHL7.EHL7Message Dim myMsg2 As New EHL7.EHL7Message Dim strVendorID As String Dim strHL7 As String Dim oSegment As Object Dim oMSH As Object myVendorObj.VendorPath = "C:\EasyHL7" strVendorID = myVendorObj.GetVendorID("Default","2.3") If strVendorID = "" Then MsgBox myVendorObj.LastError Set myVendorObj = Nothing Exit Sub End If If Not MyVendorObj.OpenVendor(strVendorID) Then MsgBox myVendorObj.LastError Set myVendorObj = Nothing Exit Sub End If With myMsg Set oMSH = .CreateMessage(myVendorObj) If .IsError Then MsgBox .LastError .ClearErrors Exit Sub End If Set oSegment = .AddSegment("EVN") If .IsError Then MsgBox .LastError .ClearErrors Exit Sub End If strHL7 = .HL7 End With With myMsg2 SetVendorObj myVendorObj If Not .CreateFromHL7(strHL7) Then MsgBox .LastError .ClearErrors Exit Sub End If MsgBox "myMsg2 is now an exact copy of myMsg" End With End Sub
Dynamic Encoding Characters
When a message is passed in with different encoding characters from those defined in the vendor definition, the HL7 message is re-encoded with the encoding characters from the HL7Vendors object.
Example: If your vendor object has a FieldSeparator property of "|" and an EncodingChars property of "^~\&" then:
If you call the CreateFromHL7() method passing an HL7 message that looks like this:
MSH§*~\&§MEDIC§MEDIC§SAMPLE§SAMPLE§20030910113004+0000*S§NO SECURITY§ADT*A05§MISYS000000002§T§2.3§000000000000002§§AL§§§§ EVN§A05§20030910113004+0000*S§§00802§00002§ PID§§123456789§0118021§123456789§POWELL*COLIN*B§§19550325§M§§§3412 PENTAGON ST**FORT WORTH*TX*76117-0000§§(817)555-1212§§§00002§§987654321§987654321§§§§§§§§§§§ PV1§§P§***00002§R§§00041§08109*WOODS*BENNY*L§0005511*TOLKIEN*JOHN*R§§MS§§§§§§§§§000376487§00005§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ PV2§§§§§§§§20030814113000§§§§MS GT1§0001§§POWELL*COLIN*B§§3412 PENTAGON**FORT WORTH*TX*76117-3517§(817)555-1212§§§§§§§§§§§§§§§ IN1§0001§0000002§0000101§SECURE HORIZONS13378§2821 LACKLAND ROAD*SUITE 214*FORT WORTH*TX*76116-0000§§(800)309-9675§ §§§§20011101§§§P§POWELL*COLIN* §00001§19210325§3412 PENTAGON**FORT WORTH*TX*76117-0000§Y§Y§§§§§§ §§§§§§§§§555121211§§§§§§§M§****§§§ IN2§§987654321§0000698*RETIRED§§I§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
The HL7 property or the return value of HL7XMLToString() method would look like this:
MSH|^~\&|MEDIC|MEDIC|SAMPLE|SAMPLE|20030910113004+0000^S|NO SECURITY|ADT^A05|MISYS000000002|T|2.3|000000000000002||AL|||| EVN|A05|20030910113004+0000^S||00802|00002| PID||123456789|0118021|123456789|POWELL^COLIN^B||19550325|M|||3412 PENTAGON ST^^FORT WORTH^TX^76117-0000||(817)555-1212|||00002||987654321|987654321||||||||||| PV1||P|^^^00002|R||00041|08109^WOODS^BENNY^L|0005511^TOLKIEN^JOHN^R||MS|||||||||000376487|00005|||||||||||||||||||||||||||||||| PV2||||||||20030814113000||||MS GT1|0001||POWELL^COLIN^B||3412 PENTAGON^^FORT WORTH^TX^76117-3517|(817)555-1212||||||||||||||| IN1|0001|0000002|0000101|SECURE HORIZONS13378|2821 LACKLAND ROAD^SUITE 214^FORT WORTH^TX^76116-0000||(800)309-9675| ||||20011101|||P|POWELL^COLIN^ |00001|19210325|3412 PENTAGON^^FORT WORTH^TX^76117-0000|Y|Y|||||| |||||||||555121211|||||||M|^^^^||| IN2||987654321|0000698^RETIRED||I||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|