SetEscFieldValue() |
Top Previous Next |
Object: EHL7.EHL7Message FileName: EHL7.dll
METHOD
Name: SetEscFieldValue() Parameters: 1) strValue (String) the field data in string format 2) oSegment (Segment Object) 3) nFieldNumber (Long) index of the data field in the segment (1-xxx) to set the value of 4) nFieldComponent (Long) which component of the field element to set value of. Unlike the SetFieldValue() method, this parameter is NOT optional.
Returns: N/A Description: Used in the creation of HL7 Messages sets the value of Component (nFieldComponent) in field element (nFieldNumber) of segment (oSegment) to strValue while first calling the VendorEscData() method against strData.
Example: Private Sub MessageTest() Dim myVendorObj As New EHL7.HL7Vendors Dim myMsg As New EHL7.EHL7Message Dim strVendorID As String Dim oSegment As Object Dim oMSH As Object Dim i As Long 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) 'Do some processing of the MSH Segment If .IsError Then MsgBox .LastError .ClearErrors Exit Sub End If 'Add a patient identifier segment Set oSegment = .AddSegment("PID") If .IsError Then MsgBox .LastError .ClearErrors Exit Sub End If 'Add the patient's name .SetFieldValue "Smith", oSegment, 5, 1 .SetFieldValue "John", oSegment, 5, 2 .SetFieldValue "J", oSegment, 5, 3 .SetEscFieldValue "Jr&MD", oSegment, 5, 4 .SetFieldValue "Mr", oSegment, 5, 5
'Add the Patient's Sex only 1 component for field 8 so I can 'ignore the 4th parameter .SetFieldValue "M", oSegment, 8 'Now get the values back out. 'Show the whole name with component delimiters MsgBox "The patient name data is: " & .GetEscFieldValue(oSegment,5,0) 'Show the whole name with component delimiters without 'Unescaping' it MsgBox "The 'Unescaped' patient name data is: " & .GetFieldValue(oSegment,5,0) End With End Sub
|