Returns the loop level that the Data Segment is in.
Syntax:
Returns:
A number that depicts the level of the loop the data segment is in. If the data segment does not belong in a loop, the LoopLevel method returns a 0.
Remarks:
The loop level indicates how deep the loop, that the data segment is in, is nested.
For example, the following diagram shows the loop level value of segments in an ASC/X12 Transaction Set 997 (Functional Acknowledgment).
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