Framework EDI Reference. Methods and Properties
ediDataSegment. NextInstance

Gets the next data segment that is in the same instance of the calling data segment.

Syntax:

Returns

Returns an object of type FREDI.ediDataSegment. If there is no data segment that follows the current data segment, an empty object is returned.

Remarks

Instances of data segments are equivalent if they fall in the same hierarchy of the EDI structured tree.

Example

Set oSegmentLoop = oSegment.GetDataSegmentByPos("\ISA\GS\ST\N1\N1")
While Not oSegmentLoop Is Nothing
    sEntity = oSegmentLoop.DataElementValue(1)

    If sEntity = "BT" Then
        txtBillToName.Text = oSegmentLoop.DataElementValue(2)
        txtBillToDUNS.Text = oSegmentLoop.DataElementValue(4)
        txtBillToAddress.Text = oSegmentLoop.DataElementValueByPos("N3<166>")
        txtBillToCity.Text = oSegmentLoop.DataElementValueByPos("N4<19>")
        txtBillToState.Text = oSegmentLoop.DataElementValueByPos("N4<156>")
        txtBillToZip.Text = oSegmentLoop.DataElementValueByPos("N4<116>")

    ElseIf sEntity = "ST" Then
        txtShipToName.Text = oSegmentLoop.DataElementValue(2)
        txtShipToDUNS.Text = oSegmentLoop.DataElementValue(4)
        txtShipToAddress.Text = oSegmentLoop.DataElementValueByPos("N3<166>")
        txtShipToCity.Text = oSegmentLoop.DataElementValueByPos("N4<19>")
        txtShipToState.Text = oSegmentLoop.DataElementValueByPos("N4<156>")
        txtShipToZip.Text = oSegmentLoop.DataElementValueByPos("N4<116>")
    End If 'sAddrQlfr

    Set oSegmentLoop = oSegmentLoop.NextInstance
Wend