Returns the count of Data Elements that contain data in a Data Segment.
Syntax:
Remarks
This count returns number of Data Elements that contain relevant data. The relevant data can also be an empty value but which precedes the last non-empty value in the Data Elements collection, or precedes the last mandatory Data Element in the collection. For example, consider the Data Segment PER (ASC/X12) which has 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 There are 9 data elements, but there are only 3 data elements that contain actual data: 01, 02 and 04. The Count property will return 4 because the data element in position 03 is relevant because it precedes the last data element containing data, which is data element in position 04. In another scenario, if the last Data Element at position 09 had a mandatory requirement then the Count property would return 9. This is because even though the value is empty at position 9, the mandatory requirement makes this Data Element relevant, thus making all the other data elements preceding it also relevant.
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