RepeatElement Method

Adds a new repetition to the current element.

Syntax

int RepeatElement();

Remarks

RepeatElement is used to write repeated data elements in supporting version of X12 or EDIFACT. To use it, first write the first repetition of the simple or composite data element and then call RepeatElement to repeat it, then write again.

Example: Repeating a simple data element:

  EDIWriter writer = new EDIWriter();
  ...
  writer.StartSegment("Tag");
  ...
  writer.WriteElementString("R1_1");
  writer.RepeatElement();
  writer.WriteElementString("R1_2");
  writer.RepeatElement();
  writer.WriteElementString("R1_3");
  ...
  writer.EndSegment();

Example: Repeating a composite data element:

  EDIWriter writer = new EDIWriter();
  ...
  writer.StartSegment("Tag");
  ...
  writer.StartElement();
  writer.WriteComponentString("C1_1");
  writer.WriteComponentString("C2_1");
  writer.RepeatElement();
  writer.WriteComponentString("C1_2");
  writer.WriteComponentString("C2_2");
  writer.RepeatElement();
  writer.WriteComponentString("C1_3");
  writer.EndElement();
  ...
  writer.EndSegment();

Error Handling

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) 2021 /n software inc. - All rights reserved.
IPWorks X12 2020 Qt Edition - Version 20.0 [Build 7721]