Framework EDI Reference. Methods and Properties
ediDocument. FirstInterchange

Returns the first interchange object of the document.

Syntax:

Returns

Returns an object of type FREDI.ediInterchange if successful; otherwise it returns Empty if the call fails, or if the EDI document is empty.

Remark

An interchange in X12 starts with the segment ISA and ends with the segment IEA.  In UN/EDIFACT, the interchange starts with segment UNB and ends with segment UNZ.  In an EDI document, there can be multiple interchanges.  The FirstInterchange method return the first interchange in the EDI file.

Example

oEdiDoc.LoadEdi "INVOIC.TXT"

Set oInterchange = oEdiDoc.FirstInterchange

Set oSegment = oInterchange.GetDataSegmentHeader
sReceiverId = oSegment.DataElementValue(3, 1)
If sReceiverId = "12345ABC" Then
    'process interchange
ElseIf sReceiverId = "78490EFG" Then
    'process interchange
End If