Framework EDI Reference. Methods and Properties
ediSchemas. LoadSchemaBySetValue

Loads a schema depending on a data element value in the ASC/X12 Transaction Set or UN/EDIFACT Message.

Syntax:

 Parameters:

Returns:

Returns 1 if successful; 0 if unsuccessful.

Remarks:

The LoadSchemaBySetValue allows the client to direct the use of a particular schema depending on a data element value. This is useful in cases where transaction sets having the same ID vary by definition and each definition can only be applied to the document having some specific value in a data element contained in a transaction set/message.  The schema to use can be referenced using the version/release information and, optionally, the implementation name.

In a Standard Exchange Format (SEF) file, the version information and the implementation name are specified in the .INI section.

To set up the SEF file as one of the schema to load using the LoadSchemaBySetValue, specify the implementation name as "REQUEST" and the version string as "004 010 X094".  The strings are separated by a back slash as follows "004 010 X094\REQUEST".  If there are no backslash, the entire string is accepted as the entire version string information.

oSchemas.LoadSchemaBySetValue "278", "BHT", 2, 0, "11", "004 010 X094\REQUEST"

The following example shows the method without the implementation name.

oSchemas.LoadSchemaBySetValue "278", "BHT", 2, 0, "11", "004 010 X094"

Note that the value tested is in a data element contained within the context of the ASC/X12 Transaction Set or UN/EDIFACT Message.  That is, the data element must be in data segments between (but not including) the ASC/X12 transaction set header (ST) and transaction set trailer (SE); or between (but not including) the UN/EDIFACT message header (UNH) or message trailer (UNT).  To load schemas dependent on data elements outside of the transaction set/message, use the LoadSchemaByHdrValue method.

Example:

Dim oEdiDoc As Fredi.ediDocument
Dim oSchemas As Fredi.ediSchemas

Set oEdiDoc = New Fredi.ediDocument
Set oSchemas = oEdiDoc.GetSchemas

' Indicate use of 278 version 004010/X094REQUEST schema.
oEdiDoc.LoadSchema App.Path & "\278REQUEST.SEF", 0

' Indicate use of 278 version 004010/X094RESPONSE schema.
oEdiDoc.LoadSchema App.Path & "\278RESPONSE.SEF", 0

' Disable standard reference
oSchemas.EnableStandardReference = False

' Set up the definitions.
oSchemas.LoadSchemaBySetValue "278", "BHT", 2, 0, "13", "004 010 X094REQUEST"
oSchemas.LoadSchemaBySetValue "278", "BHT", 2, 0, "11", "004 010 X094RESPONSE"

oEdiDoc.LoadEdi App.Path & "\278.x12"

  Samples: