StartSegment Method

Creates a new EDI data segment on the current document.

Syntax

ANSI (Cross Platform)
int StartSegment(const char* lpszSegmentType);

Unicode (Windows)
INT StartSegment(LPCWSTR lpszSegmentType);
- (void)startSegment:(NSString*)segmentType;
#define MID_TRADACOMSWRITER_STARTSEGMENT 21

IPWORKSEDI_EXTERNAL int IPWORKSEDI_CALL IPWorksEDI_TRADACOMSWriter_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);

Remarks

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.

Error Handling (C++)

This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks EDI 2020 C++ Edition - Version 20.0 [Build 8203]