Creates a new EDI data segment on the current document.
async x12writer.startSegment(segmentType : string): Promise<void>
When called, a new data segment is created in the current transaction and set as the current segment. You can then set the values on said segment. Creating a new data segment automatically writes the previous current segment to the output stream.
The SegmentType argument specifies the type of data segment to create, using an XPath-like syntax, based on the transaction set schema. For example, to create a new N1 segment on the first N1 loop, specify "/N1Loop1/N1".
It's important to realize that segments must be created in the same order they should appear on the target EDI document. The EDIWriter component doesn't automatically enforce ordering rules, nor does it force the document to reorder segments in loops automatically.