Framework EDI Reference. Methods and Properties
ediDocument. CreateInterchange

Creates a new interchange.

Syntax:

Parameters:

Returns

If successful an FREDI.ediInterchange object is returned; otherwise an empty object is returned.

Remarks

The <sAgency> and <sVersionString> parameters are used to select the one schema that is used as a guideline for the creation of the interchange.  FREDI will search through the list of one or more schemas that have been loaded (or imported) before the call of this method, and/or the standard reference library, for a matching agency and version.  If one is found, then the schema is used; otherwise the method will fail.

ASC/X12:  By default, the first five characters of the version string is stored in the Interchange Control Version (I11) data element of the Interchange Header (ISA) control segment.  For example, if the version string was "004010X091" then "00401" is assigned to the data element by default.  Also note that it is also possible to pass "00401" as the <sVersionString> parameter, but if more that one schema has a matching version and release of "00401" then any one can be selected.  For example, if the schemas having versions "004010", "004012" or "004010X091" have been loaded then one of the three can be selected, whichever was first encountered and matched in the list.

 

Example

Set oInterchange = oEdiDoc.CreateInterchange("X", "004010")
'Gets the ISA segment (created above), then the element's values are changed.
Set oSegment = oInterchange.GetDataSegmentHeader
oSegment.DataElementValue(1) = "00"
oSegment.DataElementValue(3) = "00"
oSegment.DataElementValue(5) = "ZZ"
oSegment.DataElementValue(6) = "SENDERISA"
oSegment.DataElementValue(7) = "ZZ"
oSegment.DataElementValue(8) = "RECEIVERISA"
oSegment.DataElementValue(9) = "960807"
oSegment.DataElementValue(10) = "1548"
oSegment.DataElementValue(11) = "U"
oSegment.DataElementValue(12) = "00401"
oSegment.DataElementValue(13) = "000000020"
oSegment.DataElementValue(14) = "0"
oSegment.DataElementValue(15) = "T"
oSegment.DataElementValue(16) = ">"