Framework EDI Reference. Methods and Properties
ediDocument. SetCurrentSchema

Makes the schema, with the specified name, the starting (or default) schema to use as the guideline for the EDI document translation.

Syntax:

Parameters:

Returns:

Returns 1 if the operation is successful; otherwise the operation returns zero.

Remarks:

This method allows the client to direct the component to use the specified schema as the starting schema (or default schema).  The version of the schema must be the same as the EDI it is intended to translate, otherwise another schema with a matching version of the EDI document will be used to translate the EDI document.  If there are more than one schema with the same version the starting default schema will be used to translate the EDI file having the same version.

The implementation name of the SEF file is the first parameter in the .INI section. For example, the implementation name below is "PO4010"

.INI
PO4010,,004 010,X,X12-4010,EXAMPLE INI

This SetCurrentSchema method should be called after all the schema(s) to be used are loaded.  See example below.

 

Example:

Dim oEdiDoc As Fredi.ediDocument
Dim oSchema As Fredi.ediSchema
:
Set oEdiDoc = New ediDocument
Set oSchema1 = oEdiDoc.LoadSchema(“C:\FILES\4010\850.SEF”, Schema_Standard_Exchange_Format)  ' Implementation name "850_4010"
Set oSchema2 = oEdiDoc.LoadSchema(“C:\FILES\4020\850.SEF”, Schema_Standard_Exchange_Format)  ' Implementation name "850_4020"
:
oEdiDoc.SetCurrentSchema("850_4020", Schema_Standard_Exchange_Format)
:
oEdiDoc.LoadEdi "C:\FILES\4020\850.EDI  ' Uses the SEF file “C:\FILES\4020\850.SEF” first.