Framework EDI Reference. Methods and Properties
ediDataSegment. GetDataSegmentByPos

Returns the data segment object in the document tree hierarchy that was specified by the hierarchical string.

Syntax:

Parameters:

Returns

Object of type FREDI.ediDataSegment.

Remarks

All data segments in the EDI document are contained in a loop area. The position of any data segment in the tree hierarchy is defined by knowing all the loop area and the instance of the loop that it is contained in, starting with the outermost loop (lowest) to the innermost (highest) and combining the loop tag by a back slash (\) and then ending with the segment id of the data segment. This string combination defines the tree hierarchy using the loop tags. For example, a data segment BEG in the X12 850 version 4010 will have a tree hierarchy definition of “\ISA\GS\ST\BEG”.  For more details on the hierarchy syntax, please see Hierarchical String Syntax.

This method is only supported when the Cursor Type is set to Dynamic, and is only recommended for short EDI files.

Example
:
Set oSegment = oEdiDoc.FirstDataSegment
Set oSegment = oSegment.GetDataSegmentByPos("\ISA\GS\ST\BEG")
txtPONumber.Text = oSegment.DataElementValue(3)
txtPODate.Text = oSegment.DataElementValue(5)