Framework EDI Reference. Methods and Properties
ediDataSegment. UsageInstance

Returns the usage instance of a data segment.

Syntax:

Returns:

A number of the instance of the data segment.

Remarks:

The usage instance of a data segment is the instance that a data segment in a specific position of the transaction set has been repeated.  The maximum instances of a segment is indicated by its maximum use property.

Example:

Dim oEdiDoc As Fredi.ediDocument
Dim oSegment As Fredi.ediDataSegment
...

Set oSegment = oEdiDoc.FirstDataSegment
Do While Not oSegment Is Nothing

    If oSegment.UsageInstance > oSegment.MaximumUse Then
        MsgBox "Error. Segment has more than allowable instances"
    End If

    Set oSegment = oSegment.Next
Loop

Sample

Visual Basic program displaying Data Segment properties