GetMessageHL7()

Top  Previous  Next

Object: EHL7.HL7File

FileName: EHL7.dll

 

METHOD

 

Name: GetMessageHL7()

Parameters: nMessage (Long) Which message to retrieve

Returns: String

Description: Returns one HL7 message in string format.

 

*Note: This method can only be used after the ProcessCompleted event has fired and only if KeepMessagesInMemory is set to True

 

Related Events: Process, ProcessCompleted, MessageRead, MessageProcessed, KeepMessagesInMemory

 

Example:

'At Class or Form Declaration Level

Private WithEvents myFileObj As EHL7.HL7File

 

'On Initialize or Load

Set myFileObj = New EHL7.HL7File

myFileObj.VendorPath = "C:\EasyHL7"

 

'On Terminate or Unload

Set myFileObj = Nothing

 

'Command Button

Private Sub Command1_Click()

Dim myVendorObj As New EHL7.HL7Vendors

Dim strVendorID As String

Dim iCnt As Long, i As Long

Dim strMsg As String

myFileObj.KeepMessagesInMemory = True

myVendorObj.VendorPath = "C:\EasyHL7"

strVendorID = myVendorObj.GetVendorID("Default","2.3")

'Now open a file

If Not MyFileObj.OpenFile("C:\Test.hl7", strVendorID, -1)

       MsgBox myFileObj.LastError

      myFileObj.ClearErrors

      Exit Sub

End If

iCnt = myFileObj.MessageCount

MsgBox "File contains " & iCnt & " hl7 messages"

For i = 1 To iCnt

   strMsg = myVendorObj.GetMessageHL7(i)

   Call ProcessHL7MessageFunction(strMsg)

Next

End Sub

 

Private Sub ProcessHL7Message(strHL7 As String)

'Code to Process HL7

End Sub

 

Private Sub ProcessXMLMessage(strXML As String)

'Code to Process XML

End Sub

 

 

'Event Handlers

Private Sub myFileObj_Process(nFunction As Long, nFunctionCount As Long, nPct As Long, strMessage As String)

       Label1.Caption = "Process " & nFunction & " of " & nFunctionCount & " is " & nPct & "% complete"

       DoEvents

End Sub

 

Private Sub myFileObj_ProcessCompleted()

If myFileObj.Cancel Then

  MsgBox "Process Canceled"

Else

MsgBox "Process Completed"

End If

End Sub