Framework EDI Reference. Methods and Properties
ediDataSegment. LoopSection

Returns the loop section of the data segment.

Syntax:

Remarks

The loop section is a series of loop IDs in a string that describes the loops that the data segment is nested under.  The loop IDs begin with the lowest nesting loop level (outermost) ID and ending with the highest nesting loop level (innermost) ID separated by a semi-colon.  A loop ID is the identifier of the first data segment (loop trigger) in the loop.

A data segment not nested in any loop will return an empty string loop section.

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

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

There are two loops: LIN and N1.

Loop N1 is a higher nesting level than loop LIN.

The data segments ST and BEG will have an empty loop section because they are not nested in any loop.

The data segments LIN, PO1, and G53 will have a loop section value of "LIN".

The data segments N1, N2, N3 and N4 will have a loop section value of "LIN;N1".

Note that a data segment in an ASC/X12 Transaction Set or UN/EDIFACT Message can be uniquely identified by its Area, LoopSection and its segment ID properties.

Example

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

    If nArea = 2 Then
        If sLoopSection = "LIN;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

Sample

Visual Basic program displaying Data Segment properties