Returns the nesting level of the loop of the data segment.
Syntax:
Remarks:
A loop that nests another loop is in a lower nesting level than the loop that it nests. That is, the outermost loop has the lowest nesting level, and the innermost loop has the highest nesting level. The nesting level of a loop is represented by a number which begins with zero when a data segment is not in a nested loop, and subsequent loop nesting increments the nesting level by one.
For example, the following diagram shows the structure of an ASC/X12 Transaction Set 997 (Functional Acknowledgment) document.
Data segment ST, AK1, AK9 and SE is not in a nested loop, so their LoopLevel property is zero.
Data segment AK2 and AK5 is in loop AK2, which is nested in ST, so their LoopLevel property is 1.
Data segment AK3 and AK4 is in loop AK3, which is nested in AK2, which in turn is nested in ST, so their LoopLevel property is 2.
Example:
Set oSegment = oEdiDoc.FirstDataSegment
Do While Not oSegment Is Nothing
sLoopSection = oSegment.LoopSection
If sLoopSection = "" Then
MsgBox oSegment.LoopLevel 'returns 0
ElseIf sLoopSection = "N1" Then
MsgBox oSegment.LoopLevel 'returns 1
ElseIf sLoopSection = "IT1;PID" Then
MsgBox oSegment.LoopLevel 'returns 2
End If
Set oSegment = oSegment.Next
Loop
Sample