Framework EDI Reference. Methods and Properties
ediDataElement. Previous

Gets the previous data element in the collection.

Syntax:

Returns

Returns an object of type FREDI. ediDataElement; otherwise an empty object or NULL is returned if no previous data element exists.

Remarks

The previous data element has an ordinal position one less than this data element in the same collection.  If this data element is the first data element in the collection then an empty object is returned.

Example

Dim oEdiDoc As Fredi.ediDocument
Dim oSchemas As Fredi.ediSchemas
Dim oSchema As Fredi.ediSchema
Dim oDataElement As Fredi.ediDataElement
Dim oDataSegment As Fredi.ediDataSegment

' Create instance of Framework EDI.
Set oEdiDoc = New Fredi.ediDocument

' Disable standard reference library.
Set oSchemas = oEdiDoc.GetSchemas
oSchemas.EnableStandardReference = False

' Load the schema that the EDI file will use.
Set oSchema = oEdiDoc.LoadSchema(App.Path & "\SampleSefX12_850.SEF", Schema_Standard_Exchange_Format)

' Process the EDI file.
oEdiDoc.LoadEdi App.Path & "\SampleEdiX12_850.X12"

' Get first data segment in document.
Set oDataSegment = oEdiDoc.FirstDataSegment

' Get the data element that is the 5th position of the BEG data segment.
Set oDataElement = oDataSegment.GetDataElementByPos("\ISA\GS\ST\BEG<373>")

' Get the previous data element in the collection.
Set oDataElement = oDataElement.Previous

MsgBox "Previous data element is " & oDataElement.ID

Sample

M_Previous.zip