StartSegment Method
Creates a new IDoc data segment on the current IDoc document.
Syntax
idocwriter.startSegment(segmentName, [callback])
Callback
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for this method is defined as:
function(err){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
When called, a new data record segment is created in the current IDoc document and set as the current segment. Creating a new data record segment automatically writes the previous current segment to the output stream.
The SegmentName parameter specifies the name of the current segment.
It is important to realize that segments must be created in the same order they should appear on the target IDoc document. The IDocWriter component does not automatically enforce ordering rules.
Example IDocWriter Code:
idocwriter1.StartIDoc() idocwriter1.WriteControlRecord() idocwriter1.StartSegment("Segment1") idocwriter1.WriteFieldValue("Field1", "Value1") idocwriter1.WriteFieldValue("Field2", "Value2") ... idocwriter1.EndSegment() idocwriter1.StartSegment("Segment2") idocwriter1.WriteFieldValue("Field1", "Value1") ... idocwriter1.EndSegment() ... idocwriter1.EndIDoc()