CreateMessage() |
Top Previous Next |
Object: EHL7.EHL7Message FileName: EHL7.dll
METHOD
Name: CreateMessage() Parameters:
Returns: Object (Segment Object) - The segment object for the MSH segment. Description: This method will initiate the creation of an HL7 message using an opened vendor object. If bIncludeDefault is passed as [True] then IF Extended Element Properties (with default values) have been set up for any elements in the MSH segment the default values will be populated. If bIncludeDefault is passed as [False] (the default) then default values configured in the vendor definitions will be ignored.
*NOTE*: Regardless of whether default values have been configured in the Extended Element Properties for the MSH segment, the following values are automatically set in the MSH Segment when the CreateMessage() method is called. They can, of course be overwritten by you in subsequent SetFieldValue()method calls.
Example: Private Sub MessageTest() Dim myVendorObj As New EHL7.HL7Vendors Dim myMsg As New EHL7.EHL7Message Dim strVendorID As String Dim oSegment 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 oSegment = .CreateMessage(myVendorObj) If .IsError Then MsgBox .LastError .ClearErrors Exit Sub End If MsgBox "Default Control Number = " & .GetFieldValue(oSegment,10) MsgBox "Message Created = " & .GetFieldValue(oSegment,7) End With End Sub
|