IPWorks X12 2020 macOS Edition

Questions / Feedback?

X12Writer Module

Properties   Methods   Events   Configuration Settings   Errors  

The X12Writer component is optimized for X12 documents, providing a simple way to create X12 documents.

Syntax

nsoftware.IPWorksX12.X12writer

Remarks

The class allows you to create a document from scratch. The class allows you to create an EDI document one segment at a time. Here's how a document would normally be created:

  1. Call LoadSchema to load the necessary schemas for the transactions that will be used.
  2. Specify where to write the output document by setting the OutputFile property or SetOutputStream method, or set neither and check the OutputData property.
  3. Create a new interchange start segment using the StartInterchangeHeader method and set its properties using WriteElementString and WriteComponentString.
  4. To write a basic element value to the current location, call the WriteElementString method. For complex element values, there are two possibilities, elements which are split into components, and elements which repeat. To write these complex element values, use the StartElement and EndElement methods, with WriteComponentString and RepeatElement methods for writing the values. (Examples available below).
  5. Create a new functional group using StartFunctionalGroupHeader and set its properties using WriteElementString and WriteComponentString.
  6. Create a new transaction using StartTransactionHeader and set the properties for the header segment.
  7. Write all the data for the transaction by creating new data segments using StartSegment and providing the path of the segment to create using the schema names of the loops and segments, like /N1Loop1/N1.
  8. Once you are done with the segment, call EndSegment.
  9. Once you are done with the transaction, call CreateTransactionFooter.
  10. Once you are done with the functional group, call CreateFunctionalGroupFooter.
  11. Once the interchange is complete, call CreateInterchangeFooter.

Example X12Writer Code:


//Create an 810
//Start Interchange Header
writer.StartInterchangeHeader("004010");
writer.WriteElementString("00");
writer.SkipElement();
writer.WriteElementString("00");
writer.SkipElement();
writer.WriteElementString("ZZ");
writer.WriteElementString("ACME     ");
writer.WriteElementString("ZZ");
writer.WriteElementString("WAYNE_TECH     ");
writer.WriteElementString("160707");
writer.WriteElementString("1544");
writer.WriteElementString("U");
writer.WriteElementString("00401");
writer.WriteElementString("000000006");
writer.WriteElementString("0");
writer.WriteElementString("T");
writer.WriteElementString(">");
 
//Start Functional Group
writer.StartFunctionalGroupHeader();
writer.WriteElementString("IN");
writer.WriteElementString("ACME");
writer.WriteElementString("WAYNE_TECH");
writer.WriteElementString("20160707");
writer.WriteElementString("1544");
writer.WriteElementString("6");
writer.WriteElementString("T");
writer.WriteElementString("004010");
 
//Start Transaction Header
writer.StartTransactionHeader("810");
writer.WriteElementString("810");
writer.WriteElementString("0001");
 
//Write the BIG segment
writer.StartSegment("BIG");
writer.WriteElementString("20150708");
writer.WriteElementString("3003014445");
writer.SkipElement();
writer.WriteElementString("0476553272");
writer.SkipElement();
writer.SkipElement();
writer.WriteElementString("DR");
writer.EndElement();
 
//Write the CUR segment
writer.StartSegment("CUR");
writer.WriteElementString("SE");
writer.WriteElementString("USD");
 
 
//Write the REF segment
writer.StartSegment("REF");
writer.WriteElementString("8M");
writer.WriteElementString("0056");

Property List


The following is the full list of the properties of the module with short descriptions. Click on the links for further details.

FileWriteModeControls how the output file is opened.
OutputDataContains the output data.
OutputFileSpecifies the name of the EDI file to write to.
SchemaFormatThe format of the schema file.
SuffixWhat to append after each segment delimiter.

Method List


The following is the full list of the methods of the module with short descriptions. Click on the links for further details.

CompileSchemaCompiles an existing XSD schema into an optimized binary representation.
ConfigSets or retrieves a configuration setting.
CreateFunctionalGroupFooterCloses the current functional group by writing its footer segment.
CreateInterchangeFooterCloses the current interchange by writing its footer segment.
CreateTransactionFooterCloses the current transaction set by writing its footer segment.
DisplaySchemaInfoReturns a string showing the structure of the schema defining the document.
EndElementFinishes the current composite data element.
EndSegmentEnds writing the current segment.
FlushForces any pending segments to be written to the output stream without closing it.
LoadSchemaLoads a schema file describing a Transaction Set.
RepeatElementAdds a new repetition to the current element.
ResetResets the state of the control.
SkipComponentMoves to the next sub-element in the current composite element in the current segment.
SkipElementMoves to the next data element in the current segment.
StartElementStarts a new EDI composite data element on the current segment.
StartFunctionalGroupHeaderCreates a new EDI functional group header segment on the current document.
StartInterchangeHeaderCreates a new EDI Interchange header segment on the current document.
StartSegmentCreates a new EDI data segment on the current document.
StartTransactionHeaderCreates a new EDI transaction set header on the current document.
WriteComponentStringSets the value of the next component within the current element in the current segment.
WriteElementStringSets a value of the next element in the current segment to a simple value.
WriteTransactionWrites an entire transaction to the output.

Event List


The following is the full list of the events fired by the module with short descriptions. Click on the links for further details.

ErrorInformation about errors during data delivery.
OutputFires whenever a segment is complete.
WarningFires whenever a validation warning is encountered.

Configuration Settings


The following is a list of configuration settings for the module with short descriptions. Click on the links for further details.

ComponentDelimiterThe delimiter character to use to separate components.
EdifactSyntaxVersionChanges the syntax version used for EDIFACT control segments.
ElementDelimiterThe delimiter character to use to separate data elements.
EncodingThe character encoding to be applied when reading and writing data.
IncludeUNAWhether to include the UNA segment in the output.
ReleaseCharThe character to use to escape delimiters within values.
RepetitionCharThe repetition character.
SegmentDelimiterThe delimiter character to use to separate segments.
StrictSchemaValidationSpecifies the behavior during schema validation.
TransactionOnlyIgnores interchange and functional group validation, allowing you to build the transaction body.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
UseInternalSecurityAPITells the component whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2021 /n software inc. - All rights reserved.
IPWorks X12 2020 macOS Edition - Version 20.0 [Build 7941]