Framework EDI Reference. Methods and Properties
ediDataSegment. Count

Returns the number of data elements that contain relevant data in a data segment.

Syntax:

Remarks

Relevant data are non-empty values, or empty values that precedes the last non-empty value in the data elements collection.  For example, consider a data segment having the following data elements and associated values:

Position  ID REQ Value
01 366 M AG
02 93 O CLARK KENT
03 365 O
04 364 O 555-1818
05 365 O
06 364 O
07 365 O
08 364 O
09 443 O

The Count property will return 4.  There are 9 data elements and only 3 contain non-empty values at position 01, 02 and 04.  However, the data element in position 03 is considered relevant even though it is empty because it precedes the last data element that contain a value, which is the data element in position 04.

Example
:
Set oSegment = oEdiDoc.FirstDataSegment
Do While Not oSegment Is Nothing
    nElementCount = oSegment.Count
    For i = 1 To nElementCount
        MsgBox oSegment.DataElementValue(i)
    Next
    Set oSegment = oSegment.Next
Loop