Framework EDI Reference. Methods and Properties
ediDataSegment. GetSchema

Gets the schema of the guideline that was used to create the instance of the Data Segment.

Syntax:

Returns

Returns an object of type FREDI.ediSchema.

Remarks

The schema returned by the data segment is the same schema of the control segment that envelopes the data segment. The schema of the control segment is loaded based on the version information contained in the control segment header.

Example

Dim oEdiDoc As ediDocument
Dim oSchema As ediSchema
Dim oSchema2 As ediSchema
Dim oInterchange As ediInterchange
Dim oGroup As ediGroup
Dim oTransactionSet As ediTransactionSet
Dim oDataSegment As ediDataSegment
Dim sEdiFile As String
Dim sSefFile As String

sEdiFile = App.Path & "\850.X12"
sSefFile = App.Path & "\850.SEF"

Set oEdiDoc = New ediDocument
Set oSchema = oEdiDoc.LoadSchema(sSefFile, 0)

oEdiDoc.LoadEdi sEdiFile

' Get Interchange from document
Set oInterchange = oEdiDoc.FirstInterchange

' Get Functional Group from Interchange
Set oGroup = oInterchange.FirstGroup

' Get Transaction Set from Group
Set oTransactionSet = oGroup.FirstTransactionSet

' Get Data Segment Header
Set oDataSegment = oTransactionSet.GetDataSegmentHeader

' Get First data segment in transaction Set
Set oDataSegment = oDataSegment.Next

' Get schema object of Interchange
Set oSchema2 = oDataSegment.GetSchema
Debug.Print "Schema Handle: " & oSchema2.Handle
Debug.Print "Schema Version: " & oSchema2.Version
Debug.Print "Schema Industry: " & oSchema2.Industry
Debug.Print "Schema Version: " & oSchema2.StandardVersion