MessageProcessed

Top  Previous  Next

Object: EHL7.HL7File

FileName: EHL7.dll

 

EVENT

 

Name: MessageProcessed

Parameters:

1.nMessage (Long) the sequential message number (1-nnn)
2.sHL7XML (String) a string containing the HL7 Message in EasyHL7 XML format

 

Description: During processing of a file the two events that fire that allow you to interface with the object during processing are MessageRead and MessageProcessed.  MessageRead always fires first, followed by MessageProcessed.  MessageRead will preset the HL7 message in HL7 format to your application and MessageProcessed presents the message in XML Format.

 

See Also: KeepMessagesInMemory, MessageRead

 

 

 

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

'Note that here we are not going to accumulate the HL7 messages in

'memory because we are using the event to process the message.

myFileObj.KeepMessagesInMemory = False

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

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_MessageRead(nMessage As Long, sHL7Text As String)

Call ProcessHL7Message(sHL7Text)

End Sub

 

Private Sub myFileObj_MessageProcessed(nMessage As Long, sHL7XML As String)

Call ProcessXMLMessage(sHL7XML)

End Sub

 

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"

Label2.Caption = strMessage

DoEvents

End Sub

 

Private Sub myFileObj_ProcessCompleted()

If myFileObj.Cancel Then

  MsgBox "Process Canceled"

Else

MsgBox "Process Completed"

End If

End Sub

 

Related Items: EasyHL7 Events in VB