Framework EDI Reference. Methods and Properties
ediSchemas. LoadSchemaByHdrValue

Loads a schema depending on a data element value of a control header or service segment.

Syntax:

 Parameters:

Returns:

Returns 1 if successful; 0 if unsuccessful.

Remarks:

The LoadSchemaByHdrValue allows the client to direct the use of a particular schema depending on a data element value. The schema selected will be used within the semantic entity of the specified control header regardless if the header has data stating a version to use. So for example, if as a result of the LoadSchemaByHdr a schema is going to be referenced in the function group header, the version information in the functional group will not be used to reference a schema having the same version. The schema already specified by LoadSchemaByHdr will be referenced instead.
To load schemas dependent on data elements in a transaction set/message, use the LoadSchemaBySetValue method.

Example:

The following example demonstrates two different schemas. Both define the ASC/X12 Purchase Order 850 transaction set, but one is for the X091 industry and the other is for the X092 industry. The schema for industry X091 is referenced when the transaction set with control number "001" is encountered. Likewise the schema for industry X092 is referenced when the transaction set having control number "002" is encountered in the document.

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

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

' Indicate use of 850 version 004020/X091 schema.
oEdiDoc.LoadSchema App.Path & "\850_X091.SEF", 0

' Indicate use of 850 version 004020/X092 schema.
oEdiDoc.LoadSchema App.Path & "\850_X092.SEF", 0

' Set up the definition. Load schema X091 if control number is 001
oSchemas.LoadSchemaByHdrValue "ST", 2, 0, "001", "004 020 X091"

' Set up the definition. Load schema X092 if control number is 002
oSchemas.LoadSchemaByHdrValue "ST", 2, 0, "002", "004 020 X092"

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

  Samples: