Framework EDI Reference. Methods and Properties
ediDataSegment. LoopLevelID

Returns the loop ID of a loop level that the data segment is nested under.

Syntax:

Parameters:

Remarks

All loops are identified by their loop ID.  The loop ID is normally the ID of the first data segment in the segment group making up the loop.  A data segment can be in a loop that is nested in another loop -- the nested loop being in a higher nesting level than the loop that nests it.

For example, consider the following loop structure of a document:

    ST
    BEG
    + LOOP - LIN
         LIN
         PO1
         G53
         + LOOP - N1
             N1
             N2
             N3
             N4

Loop N1 is nested in loop LIN.  Loop N1 is in a higher nesting level than loop LIN.

If the data segment is nested under loop N1 (for example, it is N1, N2, N3 or N4) then:

If the data segment is directly nested under LIN (for example, it is LIN, PO1 or G53) then:

 

Example

Set oSegment = oEdiDoc.FirstDataSegment
While Not oSegment Is Nothing
    sSegmentID = oSegment.ID
    sLoopSection = oSegment.LoopLevelID
    nArea = oSegment.Area

    If nArea = 2 Then
        If oSegment.LoopLevelID(1) = "LIN" And oSegment.LoopLevelID(2) = "N1" Then
            If sSegmentID = "N1" Then
                txtCompanyName.Text = oSegment.DataElementValue(2)
                txtCompanyID.Text = oSegment.DataElementValue(4)
            End If
        End If
    ElseIf nArea = 3 Then
        If sLoopSection = "" Then
            If sSegmentID = "BIN" Then
                Set oDataElement = oSegment.DataElement(2)
                oDataElement.ExportValue sPath & "EXported" & txtPublicKey.Text
            ElseIf sSegmentID = "ERI" Then
                txtMethodSend.Text = oSegment.DataElementValue(2)
            End If
        End If
    End If
    Set oSegment = oSegment.Next
Wend