GetFieldComponent
Returns the HL7 field contents within the message structure specified by the field
number, repeat number
and component number. The field number, repeat number and component number is
defined in the
segment definition layout.
Syntax
[ FieldBuff = String] = object.GetFieldComponent [ nMsgId = Integer], [ nFieldNbr = Integer]
[ nRepeatNbr = Integer], [ nComponentNbr = Integer]
The GetFieldComponent method syntax has these parts:
| Part | Description |
| object | An object expression that evaluates to the HL7 control. |
| nMsgId | A integer expression that specifies the message Id. |
| nFieldNbr | A integer expression that specifies the field number within the segment. |
| nRepeatNbr | A integer expression that specifies the repeat number within the field. |
| nComponentNbr | A integer expression that specifies the component number within the field. |
Returns
| Value | Description |
| FieldBuf | A string expression that will contains the field contents. |
Remarks
GetFieldComponent of an object is initiated at runtime. The GetFieldComponent
is called to extract field
contents from a field within an HL7 message. If nRepeatNbr is > 1, its assumed
that the field is a repeating
field. If nComponentNbr does not exists an error will error, Its assumed that
the programmer understands the
incoming message structure.
Example
Private Sub ShowMessage()
Dim nSendMsgId As Integer
Dim nRecvMsgId As Integer
Dim sSeg As String
Dim nCount As Integer
Dim nFieldCount As Integer
Dim sMsg As String
Dim bSuccess As Boolean
Hl7cntl1.EnvelopSupport = False
nSendMsgId = Hl7cntl1.InitMessage
Hl7cntl1.SetSegment nSendMsgId, "MSH"
Hl7cntl1.SetField nSendMsgId, "|", 1
Hl7cntl1.SetField nSendMsgId, "^~\&", 2
Hl7cntl1.SetField nSendMsgId, "GPMS", 3
Hl7cntl1.SetField nSendMsgId, "DEMO", 4
Hl7cntl1.SetField nSendMsgId, "HL7DEMO", 6
Hl7cntl1.SetField nSendMsgId, "19911030140014865", 7
Hl7cntl1.SetField nSendMsgId, "ADT", 9
Hl7cntl1.SetFieldComponent nSendMsgId, "A28", 9, 0
Hl7cntl1.SetField nSendMsgId, "14001U090", 10
Hl7cntl1.SetField nSendMsgId, "D", 11
Hl7cntl1.SetField nSendMsgId, "2.2", 12
Hl7cntl1.SetSegment nSendMsgId, "EVN"
Hl7cntl1.SetField nSendMsgId, "A28", 1
Hl7cntl1.SetField nSendMsgId, "19911030140014865", 2
Hl7cntl1.SetSegment nSendMsgId, "PID"
Hl7cntl1.SetField nSendMsgId, "1", 1
Hl7cntl1.SetField nSendMsgId, "123", 3
Hl7cntl1.SetField nSendMsgId, "Bill" & "^"
& "Gates" & "^" & """", 5
Hl7cntl1.SetField nSendMsgId, "01/01/1956", 7
Hl7cntl1.SetField nSendMsgId, "M", 8
Hl7cntl1.SetField nSendMsgId, "100 Microsoft Rd" &
"^" & "Suite 100" & "^" & "Seattle"
& "^" & "WA" & "^" &
"10010", 11
Hl7cntl1.SetField nSendMsgId, "M", 16
Hl7cntl1.SetField nSendMsgId, "111-11-1111", 19
Hl7cntl1.SetSegment nSendMsgId, "PV1"
Hl7cntl1.SetField nSendMsgId, "1", 1
Hl7cntl1.SetField nSendMsgId, "PCP01", 7
Hl7cntl1.SetSegment nSendMsgId, "GT1"
sMsg = Hl7cntl1.GetMessage(nSendMsgId)
Hl7cntl1.DeInitMessage nSendMsgId
nRecvMsgId = Hl7cntl1.InitMessage
bSuccess = Hl7cntl1.SetMessage(nRecvMsgId, sMsg)
If bSuccess = True Then
sSeg = Hl7cntl1.GetNextSegment(nRecvMsgId)
While sSeg <> ""
MsgBox sSeg
nFieldCount =
Hl7cntl1.GetFieldCount(nRecvMsgId)
For nCount = 1 To
nFieldCount
MsgBox Hl7cntl1.GetFieldComponent(nRecvMsgId, nCount, 1, 1)
Next nCount
sSeg =
Hl7cntl1.GetNextSegment(nRecvMsgId)
Wend
End If
Hl7cntl1.DeInitMessage nRecvMsgId
End Sub
.
..
...
This page, and all contents, are Copyright © 1998 by
Gary M. Gallagher.
Sparrow Technologies Incorporated - http://www.sparrow-technologies.com