Framework EDI Reference. Methods and Properties
ediDocument. New

Begins a new document without having to reload existing implementation guideline schemas.

Syntax:

Returns

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

Remarks

The New method closes all previous processes of an EDI document. It destroys the internal hierarchical tree and internal objects, similar to the Close method, except it preserves the following:

The New method allows one to generate multiple EDI documents that use the same schema without having to reload it.

Example

Set oEdiDoc = New Fredi.ediDocument
Set oSchema = oEdiDoc.LoadSchema(sSefFile, 0)
oEdiDoc.SegmentTerminator = "~" & vbCrLf
oEdiDoc.ElementTerminator = "*"
oEdiDoc.CompositeTerminator = ">"

Do While Not oRsInvoice.EOF

    Set oInterchange = oEdiDoc.CreateInterchange("X", "004010")
    Set oSegment = oInterchange.GetDataSegmentHeader

    oSegment.DataElementValue(1) = "00"
    oSegment.DataElementValue(3) = "00"
    oSegment.DataElementValue(5) = "ZZ"
    oSegment.DataElementValue(6) = oRsInvoice("SenderId")
    ...

    oRsInvoice.MoveNext
    oEdiDoc.New
Loop