X12Reader Component

Properties   Methods   Events   Config Settings   Errors  

The X12Reader component efficiently parses complete X12 transmissions, providing a convenient way to extract and explore data from all included transaction sets.

Syntax

EDISDK.X12Reader

Remarks

The component allows you to parse an incoming EDI document. To parse a document, first, use LoadSchema to load a schema file into the component. Next, select the document you want to process by setting InputFile or InputData and calling Parse.

As the component processes the document, its events will fire and the contents of the document will be available in the Interchange, FunctionalGroup, Message, Segment, Element, and Component properties. The corresponding *Index properties can be thought of as a path within the document. For example, setting the MessageIndex property will cause the SegmentCount property to be updated with the number of segments within the selected message, and then the SegmentIndex property can be used to select one of the segments within that message.

To manage the amount of memory used during processing, the BuildDOM property can be used to select how much of the message will be available in the properties at once:

  • bdEntireDocument - The entire document will be available at once.
  • bdInterchange - Only the current interchange and its contents will be available.
  • bdMessage - Only the current message will be available.
  • bdNone - Only the current segment and its elements will be available.

During parsing, the component performs basic validation of the incoming document. If an error is encountered, the ValidateWarning event will fire.

Property List


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

AckTypeSpecifies the type of ACK that will be generated by GenerateAck .
BuildDOMSpecifies how much of the current document should be held in memory.
ComponentThe current component.
ComponentCountThe number of components in the current Element.
ComponentIndexThe index of the current Component.
DelimitersContains the delimiters for the EDI Document.
ElementThe current element.
ElementCountThe number of elements in the current Segment.
ElementIndexThe index of the current Element.
FunctionalGroupThe current FunctionalGroup.
FunctionalGroupCountThe number of FunctionalGroups in the current Interchange.
FunctionalGroupIndexThe index of the current FunctionalGroup.
InputDataThe EDI message, specified as a string.
InputFileThe file containing the EDI message.
InterchangeThe current Interchange.
InterchangeCountThe number of Interchanges in the document.
InterchangeIndexThe index of the current Interchange.
LoopSpecifies the loop to load segments from.
SegmentThe current segment.
SegmentCountThe number of segments in the current TransactionSet.
SegmentIndexThis property is used to specify a Segment within the current TransactionSet .
TransactionSetThe current TransactionSet.
TransactionSetCountThe number of TransactionSets in the current FunctionalGroup.
TransactionSetIndexThe current TransactionSet index.
ValidateOnParseWhen true, the component will validate any documents it parses.
ValidationErrorsCollection of validation errors for the current document.

Method List


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

configSets or retrieves a configuration setting.
generateAckGenerates an ACK in response to the most recently parsed TransactionSet.
getElementValueReturns the value of the element or component at the specified path.
loadSchemaLoads schema information from a file or string data.
parseParse the EDI document and fire parsing events.
resetSets the component to its initial state.
schemaCodeDefines a code value within a list of codes.
schemaCodeListDefines a list of codes.
schemaCompositeDefines a composite element.
schemaElementDefines a simple element.
schemaElementRefAdds a reference to an element in a segment or composite element.
schemaEndEnds a schema definition.
schemaGroupDefines a group of segments.
schemaMessageDefines a message.
schemaSegmentDefines a segment.
schemaSegmentRefAdds a reference to a segment in a message or group.
schemaStartStarts a schema definition.
setInputStreamThe stream containing the EDI data.
validateValidate the EDI document and warn about any errors encountered.

Event List


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

EndFunctionalGroupFires at the end of a functional group while parsing.
EndInterchangeFires at the end of a interchange while parsing.
EndLoopFires at the end of a loop while parsing.
EndTransactionSetFires at the end of a transaction set while parsing.
ErrorFires when a parsing error occurs.
ResolveSchemaFires to request schema information for a specific transaction set.
SegmentFires at the end of a Segment while parsing.
StartFunctionalGroupFires at the beginning of a functional group while parsing.
StartInterchangeFires at the beginning of an interchange while parsing.
StartLoopFires at the beginning of a loop while parsing a transaction set.
StartTransactionSetFires at the beginning of a transaction set while parsing.
ValidateWarningFires to warn about validation errors.

Config Settings


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

InputFormatThe format of the input document.
MaxValidationErrorsThe maximum number of validation errors to return.

AckType Property (X12Reader Component)

Specifies the type of ACK that will be generated by GenerateAck .

Syntax

public int getAckType();
public void setAckType(int ackType);
Enumerated values:
  public final static int at997 = 0;

  public final static int at999 = 1;

  public final static int atTA1 = 2;

Default Value

0

Remarks

This setting specifies the type of ACK that will be generated when GenerateAck is called. Options include:

997 Functional Acknowledgement (at997 - 0)A 997 functional acknowledgement. If any syntax errors are encountered when parsing the data, the response will indicate the details of the issue.
999 Implementation Acknowledgement (at999 - 0)A 999 implementation acknowledgement. This ACK replaces a 997 ACK when in a healthcare setting, and can also report issues with standards such as HIPAA compliance.
TA1 Interchange Acknowledgement (atTA1 - 0)A TA1 technical acknowledgement, which confirms the ISA header and IEA footer are valid but does not report on the processing of the contents.

This property is not available at design time.

BuildDOM Property (X12Reader Component)

Specifies how much of the current document should be held in memory.

Syntax

public int getBuildDOM();
public void setBuildDOM(int buildDOM);
Enumerated values:
  public final static int bdEntireDocument = 0;

  public final static int bdInterchange = 1;

  public final static int bdTranSet = 2;

  public final static int bdNone = 3;

Default Value

0

Remarks

Set BuildDOM to bdEntireDocument (0) when you need to browse the current document.

Use bdInterchange (1) when parsing large documents to tell the component to only hold an internal object model of the current Interchange being parsed. When this value is used, and a new Interchange is encountered during parsing, the old interchange is cleared from memory. If the input contains a single Interchange, this is equivalent to using bdEntireDocument.

Use bdTranSet (2) when parsing large documents to tell the component to only hold an internal object model of the current transaction being parsed. When this value is used, and a new transaction is encountered during parsing, the old transaction is cleared from memory.

A value of bdNone (3) will tell the component to not save any internal state of the document being parsed, and thus browsing will be unavailable.

This property is not available at design time.

Component Property (X12Reader Component)

The current component.

Syntax

public EDIElement getComponent();

Remarks

When the current Element is a composite element, this property contains the component specified by ComponentIndex.

This property is read-only.

Please refer to the EDIElement type for a complete list of fields.

ComponentCount Property (X12Reader Component)

The number of components in the current Element.

Syntax

public int getComponentCount();

Default Value

0

Remarks

If the current Element is composite, this property contains the number of components within the element.

This property is read-only.

ComponentIndex Property (X12Reader Component)

The index of the current Component.

Syntax

public int getComponentIndex();
public void setComponentIndex(int componentIndex);

Default Value

1

Remarks

If the current Element is composite, this property is used to specify a Component within the element.

Note: When BuildDOM is set to bdentiredoc, after Parse is called the entire EDI document is parsed and stored in memory. You can then use InterchangeIndex, FunctionalGroupIndex, MessageIndex, SegmentIndex, ElementIndex and ComponentIndex to navigate to a specific Component within the parsed document.

This property is not available at design time.

Delimiters Property (X12Reader Component)

Contains the delimiters for the EDI Document.

Syntax

public X12Delimiters getDelimiters();

Remarks

This property contains the delimiters that will be used when parsing the X12 document. If the document uses delimiters other than the default, change the properties of this object to parse the document correctly.

This property is read-only and not available at design time.

Please refer to the X12Delimiters type for a complete list of fields.

Element Property (X12Reader Component)

The current element.

Syntax

public EDIElement getElement();

Remarks

This property contains the element within the current Segment specified by ElementIndex.

This property is read-only.

Please refer to the EDIElement type for a complete list of fields.

ElementCount Property (X12Reader Component)

The number of elements in the current Segment.

Syntax

public int getElementCount();

Default Value

0

Remarks

This property contains the total number of elements in the current Segment.

This property is read-only.

ElementIndex Property (X12Reader Component)

The index of the current Element.

Syntax

public int getElementIndex();
public void setElementIndex(int elementIndex);

Default Value

1

Remarks

This property is used to specify an Element within the current Segment.

Note: When BuildDOM is set to bdentiredoc, after Parse is called the entire EDI document is parsed and stored in memory. You can then use InterchangeIndex, FunctionalGroupIndex, MessageIndex, SegmentIndex and ElementIndex to navigate to specific Element within the parsed document.

This property is not available at design time.

FunctionalGroup Property (X12Reader Component)

The current FunctionalGroup.

Syntax

public X12FunctionalGroup getFunctionalGroup();

Remarks

This property contains the current FunctionalGroup within the Interchange

This property is read-only and not available at design time.

Please refer to the FunctionalGroup type for a complete list of fields.

This property is read-only.

Please refer to the X12FunctionalGroup type for a complete list of fields.

FunctionalGroupCount Property (X12Reader Component)

The number of FunctionalGroups in the current Interchange.

Syntax

public int getFunctionalGroupCount();

Default Value

0

Remarks

This property contains the number of FunctionalGroups in the current Interchange.

This property is read-only.

FunctionalGroupIndex Property (X12Reader Component)

The index of the current FunctionalGroup.

Syntax

public int getFunctionalGroupIndex();
public void setFunctionalGroupIndex(int functionalGroupIndex);

Default Value

1

Remarks

This property is used to specify a FunctionalGroup within the current Interchange.

Note: When BuildDOM is set to bdentiredoc, after Parse is called the entire EDI document is parsed and stored in memory, including all interchanges, and functional groups. You can then use InterchangeIndex and FunctionalGroupIndex to navigate to a specific FunctionalGroup within the parsed document.

This property is not available at design time.

InputData Property (X12Reader Component)

The EDI message, specified as a string.

Syntax

public String getInputData();
public void setInputData(String inputData);

Default Value

""

Remarks

Set this property to specify the input EDI message as a string. The message can then be parsed with Parse.

This property is not available at design time.

InputFile Property (X12Reader Component)

The file containing the EDI message.

Syntax

public String getInputFile();
public void setInputFile(String inputFile);

Default Value

""

Remarks

Set this property to specify the input EDI message as a file. The message can then be parsed with Parse.

If the file is not found or cannot be opened, an error will be returned.

Note: If both InputFile and InputData are set, InputData takes precedence.

This property is not available at design time.

Interchange Property (X12Reader Component)

The current Interchange.

Syntax

public X12Interchange getInterchange();

Remarks

This property contains the current Interchange within the document specified by InterchangeIndex.

This property is read-only.

Please refer to the X12Interchange type for a complete list of fields.

InterchangeCount Property (X12Reader Component)

The number of Interchanges in the document.

Syntax

public int getInterchangeCount();

Default Value

0

Remarks

This property contains the number of Interchanges in the current document.

This property is read-only.

InterchangeIndex Property (X12Reader Component)

The index of the current Interchange.

Syntax

public int getInterchangeIndex();
public void setInterchangeIndex(int interchangeIndex);

Default Value

1

Remarks

This property is used to specify an Interchange within the document.

Note: When BuildDOM is set to bdentiredoc, after Parse is called the entire EDI document is parsed and stored in memory, including all interchanges. You can then use InterchangeIndex to navigate to specific Interchange within the parsed document.

This property is not available at design time.

Loop Property (X12Reader Component)

Specifies the loop to load segments from.

Syntax

public String getLoop();
public void setLoop(String loop);

Default Value

""

Remarks

When this property is set, only segments from the specified loop and iteration will be available through the Segment properties.

A path for a loop consists of the name of the loop followed by an index indicating the iteration, like this:

reader.Loop = "N1Loop[2]";

If the loop is nested inside of another loop, the parent and child are connected by a ".":

reader.Loop = ""AK2Loop[2].AK3Loop[1]"; That can be repeated if a loop is nested more than one level deep.

This property is not available at design time.

Segment Property (X12Reader Component)

The current segment.

Syntax

public EDISegment getSegment();

Remarks

This property contains the segment within the current Message specified by SegmentIndex.

This property is read-only.

Please refer to the EDISegment type for a complete list of fields.

SegmentCount Property (X12Reader Component)

The number of segments in the current TransactionSet.

Syntax

public int getSegmentCount();

Default Value

0

Remarks

This property contains the number of elements in the current TransactionSet.

This property is read-only.

SegmentIndex Property (X12Reader Component)

This property is used to specify a Segment within the current TransactionSet .

Syntax

public int getSegmentIndex();
public void setSegmentIndex(int segmentIndex);

Default Value

1

Remarks

Note: When BuildDOM is set to bdentiredoc, after Parse is called the entire EDI document is parsed and stored in memory. You can then use InterchangeIndex, FunctionalGroupIndex, TransactionSetIndex and SegmentIndex to navigate to specific Segment within the parsed document.

This property is not available at design time.

TransactionSet Property (X12Reader Component)

The current TransactionSet.

Syntax

public X12TransactionSet getTransactionSet();

Remarks

This property contains the TransactionSet within the current Interchange or FunctionalGroup specified by TransactionSetIndex.

This property is read-only.

Please refer to the X12TransactionSet type for a complete list of fields.

TransactionSetCount Property (X12Reader Component)

The number of TransactionSets in the current FunctionalGroup.

Syntax

public int getTransactionSetCount();

Default Value

0

Remarks

This property contains the count of TransactionSets in the current FunctionalGroup.

This property is read-only.

TransactionSetIndex Property (X12Reader Component)

The current TransactionSet index.

Syntax

public int getTransactionSetIndex();
public void setTransactionSetIndex(int transactionSetIndex);

Default Value

1

Remarks

This property contains the index of the current TransactionSet within the current FunctionalGroup.

This property is not available at design time.

ValidateOnParse Property (X12Reader Component)

When true, the component will validate any documents it parses.

Syntax

public boolean isValidateOnParse();
public void setValidateOnParse(boolean validateOnParse);

Default Value

False

Remarks

When this property is set to True, the component will perform validation on the document when Parse is called. The ValidateWarning event will fire for each error it encounters.

This property is not available at design time.

ValidationErrors Property (X12Reader Component)

Collection of validation errors for the current document.

Syntax

public X12ValidationErrorDetailList getValidationErrors();

Remarks

After calling Validate this property contains details of any validation errors. Validation errors are also accessible through the ValidateWarning event as the document is validated.

This property is read-only and not available at design time.

Please refer to the X12ValidationErrorDetail type for a complete list of fields.

Config Method (X12Reader Component)

Sets or retrieves a configuration setting.

Syntax

public String config(String configurationString);

Remarks

Config is a generic method available in every component. It is used to set and retrieve configuration settings for the component.

These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.

To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.

GenerateAck Method (X12Reader Component)

Generates an ACK in response to the most recently parsed TransactionSet.

Syntax

public String generateAck();

Remarks

After parsing a TransactionSet, call this method to generate an ACK that you can send back in response. The type of ACK generated can be controlled by setting the AckType property.

GetElementValue Method (X12Reader Component)

Returns the value of the element or component at the specified path.

Syntax

public String getElementValue(String path);

Remarks

This method returns the value of the element at the specified path. The path starts at the current Message and consists of loops (with indexes to indicate the iteration), a segment tag, and 1-2 indexes to indicate the element or component.

For a simple element the path should include the path to a specific iteration of a loop (as in the Loop property), followed by a segment tag and an index for the element position within the segment, each separated by a ".":

reader.GetElementValue("N1Loop[2].N4.4");

When selecting a component of a composite element, the component index should be added after the element index:

reader.GetElementValue("AK2Loop[2].AK3Loop[1].AK4.1.1");

LoadSchema Method (X12Reader Component)

Loads schema information from a file or string data.

Syntax

public void loadSchema(String fileOrData, String messagename);

Remarks

This method loads schema information for use when parsing, validating, and translating messages.

The FileOrData parameter can be set to the path of a file containing schema data, or can be set to the contents of a schema file directly.

MessageName can be set to the name of a specific message to load only the specified message's schema information. If left empty or set to "*", the entire schema will be loaded.

Parse Method (X12Reader Component)

Parse the EDI document and fire parsing events.

Syntax

public void parse();

Remarks

This method parses the input EDI document, firing the following events as it parses:

When multiple input sources are specified, only the highest-priority input will be used, in the following order:

  1. SetInputStream
  2. InputFile
  3. InputData

Reset Method (X12Reader Component)

Sets the component to its initial state.

Syntax

public void reset();

Remarks

When called the component clears all inputs and outputs, and resets all properties to their default values.

SchemaCode Method (X12Reader Component)

Defines a code value within a list of codes.

Syntax

public void schemaCode(String schemaId, String codeListId, String value, String description);

Remarks

Creates a schema definition for a code value within a particular list of codes.

This method can be used when defining a schema instead of loading one from a file.

SchemaCodeList Method (X12Reader Component)

Defines a list of codes.

Syntax

public void schemaCodeList(String schemaId, String codeListId, String description);

Remarks

Creates a schema definition for an empty list of codes. SchemaCode can be used to add code values to the list.

This method can be used when defining a schema instead of loading one from a file.

SchemaComposite Method (X12Reader Component)

Defines a composite element.

Syntax

public void schemaComposite(String schemaId, String compositeId, String description);

Remarks

Creates a schema definition for a composite element. SchemaElementRef can be used to add components to the element.

This method can be used when defining a schema instead of loading one from a file.

SchemaElement Method (X12Reader Component)

Defines a simple element.

Syntax

public void schemaElement(String schemaId, String elementId, String dataType, int minLength, int maxLength, String codeId, String description);

Remarks

Creates a schema definition for a simple element.

This method can be used when defining a schema instead of loading one from a file.

SchemaElementRef Method (X12Reader Component)

Adds a reference to an element in a segment or composite element.

Syntax

public void schemaElementRef(String schemaId, String parentId, String elementId, String refId, boolean required, int maxCount);

Remarks

Adds a reference to an element to the specified parent, which can be the most recently defined segment or composite element.

This method can be used when defining a schema instead of loading one from a file.

SchemaEnd Method (X12Reader Component)

Ends a schema definition.

Syntax

public void schemaEnd();

Remarks

Ends a schema definition when a schema is being defined manually instead of loaded from a file.

SchemaGroup Method (X12Reader Component)

Defines a group of segments.

Syntax

public void schemaGroup(String schemaId, String groupPath, String groupId, boolean required, int maxCount);

Remarks

Creates a schema definition for a group of segments. SchemaSegmentRef can be used to add references to defined segments.

This method can be used when defining a schema instead of loading one from a file.

SchemaMessage Method (X12Reader Component)

Defines a message.

Syntax

public void schemaMessage(String schemaId, String messageId, String description);

Remarks

Creates a schema definition for a message. SchemaSegmentRef and SchemaGroup can be used to add segment references and groups to the message.

This method can be used when defining a schema instead of loading one from a file.

SchemaSegment Method (X12Reader Component)

Defines a segment.

Syntax

public void schemaSegment(String schemaId, String segmentId, String description);

Remarks

Creates a schema definition for a segment. SchemaElementRef can be used to add component references to the segment.

This method can be used when defining a schema instead of loading one from a file.

SchemaSegmentRef Method (X12Reader Component)

Adds a reference to a segment in a message or group.

Syntax

public void schemaSegmentRef(String schemaId, String segmentPath, String segmentId, boolean required, int maxCount);

Remarks

Adds a reference to a segment to the specified path.

This method can be used when defining a schema instead of loading one from a file.

SchemaStart Method (X12Reader Component)

Starts a schema definition.

Syntax

public void schemaStart(String schemaId);

Remarks

Starts manually defining a schema, as an alternative to loading one from a file.

SetInputStream Method (X12Reader Component)

The stream containing the EDI data.

Syntax

public void setInputStream(java.io.InputStream inputStream);

Remarks

Call this method to specify a stream to read the input EDI data from. The data can then be parsed with Parse.

Validate Method (X12Reader Component)

Validate the EDI document and warn about any errors encountered.

Syntax

public void validate();

Remarks

This method parses the input EDI document, firing the ValidateWarning event for any non-blocking errors it encounters.

EndFunctionalGroup Event (X12Reader Component)

Fires at the end of a functional group while parsing.

Syntax

public class DefaultX12ReaderEventListener implements X12ReaderEventListener {
  ...
  public void endFunctionalGroup(X12ReaderEndFunctionalGroupEvent e) {}
  ...
}

public class X12ReaderEndFunctionalGroupEvent {
  public String tag;

  public int transactionCount;

  public String controlNumber;

}

Remarks

This event fires when the component encounters the end of a functional group while parsing a document.

EndInterchange Event (X12Reader Component)

Fires at the end of a interchange while parsing.

Syntax

public class DefaultX12ReaderEventListener implements X12ReaderEventListener {
  ...
  public void endInterchange(X12ReaderEndInterchangeEvent e) {}
  ...
}

public class X12ReaderEndInterchangeEvent {
  public String tag;

  public int groupCount;

  public String controlNumber;

}

Remarks

This event fires when the component encounters the end of a interchange while parsing a document.

EndLoop Event (X12Reader Component)

Fires at the end of a loop while parsing.

Syntax

public class DefaultX12ReaderEventListener implements X12ReaderEventListener {
  ...
  public void endLoop(X12ReaderEndLoopEvent e) {}
  ...
}

public class X12ReaderEndLoopEvent {
  public String name;

  public int index;

}

Remarks

This event fires when the component encounters the end of a loop while parsing a document.

EndTransactionSet Event (X12Reader Component)

Fires at the end of a transaction set while parsing.

Syntax

public class DefaultX12ReaderEventListener implements X12ReaderEventListener {
  ...
  public void endTransactionSet(X12ReaderEndTransactionSetEvent e) {}
  ...
}

public class X12ReaderEndTransactionSetEvent {
  public String tag;

  public int segmentCount;

  public String controlNumber;

}

Remarks

This event fires when the component encounters the end of a transaction set while parsing a document.

Error Event (X12Reader Component)

Fires when a parsing error occurs.

Syntax

public class DefaultX12ReaderEventListener implements X12ReaderEventListener {
  ...
  public void error(X12ReaderErrorEvent e) {}
  ...
}

public class X12ReaderErrorEvent {
  public int errorCode;

  public String description;

}

Remarks

This event fires when the component encounters a parsing error while processing a document.

ResolveSchema Event (X12Reader Component)

Fires to request schema information for a specific transaction set.

Syntax

public class DefaultX12ReaderEventListener implements X12ReaderEventListener {
  ...
  public void resolveSchema(X12ReaderResolveSchemaEvent e) {}
  ...
}

public class X12ReaderResolveSchemaEvent {
  public String versionNumber;

  public String transactionSetIDCode;

}

Remarks

LoadSchema can be called from within this event to load the schema information for the specified transaction set.

Segment Event (X12Reader Component)

Fires at the end of a Segment while parsing.

Syntax

public class DefaultX12ReaderEventListener implements X12ReaderEventListener {
  ...
  public void segment(X12ReaderSegmentEvent e) {}
  ...
}

public class X12ReaderSegmentEvent {
  public String tag;

  public String schemaPath;

  public boolean optional;

  public int elementCount;

  public int schemaIndex;

  public int segmentIndex;

  public int maxCount;

  public String path;

}

Remarks

Fires at the end of a Segment while parsing a document with the Parse method. The parameters provide information about the segment that was just parsed: Tag: The segment tag (e.g., "ISA", "GS", "ST", etc.).

SchemaPath: The schema path for the segment, if schema information is available.

Optional: A boolean indicating whether the segment is optional (true) or required (false) according to the schema.

ElementCount: The number of elements in the segment.

SchemaIndex: The index of the segment in the schema, if schema information is available.

SegmentIndex: The index of the segment within the current transaction set.

MaxCount: The maximum number of times this segment can occur in the current context, according to the schema.

Path: The full path to the segment within the message structure.

StartFunctionalGroup Event (X12Reader Component)

Fires at the beginning of a functional group while parsing.

Syntax

public class DefaultX12ReaderEventListener implements X12ReaderEventListener {
  ...
  public void startFunctionalGroup(X12ReaderStartFunctionalGroupEvent e) {}
  ...
}

public class X12ReaderStartFunctionalGroupEvent {
  public String tag;

  public String appSenderCode;

  public String appReceiverCode;

  public String dateTime;

  public String controlNumber;

}

Remarks

This event fires when the component encounters the start of a functional group while parsing a document.

StartInterchange Event (X12Reader Component)

Fires at the beginning of an interchange while parsing.

Syntax

public class DefaultX12ReaderEventListener implements X12ReaderEventListener {
  ...
  public void startInterchange(X12ReaderStartInterchangeEvent e) {}
  ...
}

public class X12ReaderStartInterchangeEvent {
  public String tag;

  public String senderID;

  public String receiverID;

  public String dateTime;

  public String controlNumber;

}

Remarks

This event fires at the beginning of an interchange while parsing a document.

StartLoop Event (X12Reader Component)

Fires at the beginning of a loop while parsing a transaction set.

Syntax

public class DefaultX12ReaderEventListener implements X12ReaderEventListener {
  ...
  public void startLoop(X12ReaderStartLoopEvent e) {}
  ...
}

public class X12ReaderStartLoopEvent {
  public String name;

  public int index;

  public int maxCount;

  public String path;

}

Remarks

This event fires when the component encounters the start of a loop while parsing a transaction set.

StartTransactionSet Event (X12Reader Component)

Fires at the beginning of a transaction set while parsing.

Syntax

public class DefaultX12ReaderEventListener implements X12ReaderEventListener {
  ...
  public void startTransactionSet(X12ReaderStartTransactionSetEvent e) {}
  ...
}

public class X12ReaderStartTransactionSetEvent {
  public String tag;

  public String versionNumber;

  public String transactionSetIDCode;

  public String controlNumber;

  public boolean schemaLoaded;

}

Remarks

This event fires when the component encounters the start of a transaction set while parsing a document.

ValidateWarning Event (X12Reader Component)

Fires to warn about validation errors.

Syntax

public class DefaultX12ReaderEventListener implements X12ReaderEventListener {
  ...
  public void validateWarning(X12ReaderValidateWarningEvent e) {}
  ...
}

public class X12ReaderValidateWarningEvent {
  public long position;

  public int line;

  public int column;

  public String errorCode;

  public String errorMessage;

  public int errorType;

}

Remarks

When the component encounters a non-blocking error while validating a document, this event fires with information about the error.

EDIElement Type

An element of an EDI document.

Remarks

This represents an element appearing in an EDI document.

The following fields are available:

Fields

DataType
String (read-only)

Default Value: ""

The type of data contained in the element.

Possible values for EDIFACT include:

A The element can only contain alphabetic characters.
AN The element can contain any alphanumeric characters.
N The element can only contain numeric characters.
composite The element is a composite element containing multiple components.

Possible values for X12 include:

AN The element can contain any alphanumeric characters.
ID The element contains an identifier for a code value.
Nn The element contains a numeric integer value.
R The element contains a number with an optional decimal value.
DT The element contains a string representing a date.
TM The element contains a string representing a time.
B The element contains binary data.
composite The element is a composite element containing multiple components.

IsComposite
boolean (read-only)

Default Value: False

Specifies whether the element is a simple or composite element. If true, the element is a composite element that contains other components.

MaxLen
int (read-only)

Default Value: 0

For a simple element, this specifies the maximum length of the element according to the schema.

MinLen
int (read-only)

Default Value: 0

For a simple element, this specifies the minimum length of the element according to the schema.

SchemaDesc
String (read-only)

Default Value: ""

The description of the element as specified in the schema.

SchemaName
String (read-only)

Default Value: ""

The name of the element as specified in the schema.

Value
String (read-only)

Default Value: ""

If the element is a simple element, this field contains its value.

Constructors

public EDIElement();

EDISegment Type

A segment of an EDI document.

Remarks

This represents a segment appearing in an EDI document.

The following fields are available:

Fields

Optional
boolean (read-only)

Default Value: False

Specifies whether the segment is required or optional. If true, the element is optional.

Path
String (read-only)

Default Value: ""

Contains the path to the segment, including the groups that the segment is contained in.

SchemaPath
String (read-only)

Default Value: ""

Contains a numeric representation of the path to the segment, using the indexes within the schema, such as \4[3]\5[6]\7[8].

Tag
String (read-only)

Default Value: ""

The tag of the segment, such as BGM, DTM, FTX, etc.

Constructors

public EDISegment();

X12Delimiters Type

The delimiters used in the X12 document.

Remarks

This type contains fields specifying the various delimiters used within the X12 document.

The following fields are available:

Fields

Component
String

Default Value: ":"

The delimiter separating components.

In X12Reader, this type is used to hold the delimiters found when parsing the component, while in X12Writer the fields can be set to choose the delimiters that will be used when writing

Element
String

Default Value: "*"

The delimiter separating elements.

In X12Reader, this type is used to hold the delimiters found when parsing the element, while in X12Writer the fields can be set to choose the delimiters that will be used when writing

Repetition
String

Default Value: "^"

The delimiter separating components.

In X12Reader, this type is used to hold the delimiters found when parsing the component, while in X12Writer the fields can be set to choose the delimiters that will be used when writing

Segment
String

Default Value: "~"

The delimiter separating segments.

In X12Reader, this type is used to hold the delimiters found when parsing the segment, while in X12Writer the fields can be set to choose the delimiters that will be used when writing

Constructors

public X12Delimiters();

X12FunctionalGroup Type

A functional group of messages.

Remarks

This type represents a functional group of messages, with fields describing the values from the GS segment.

The following fields are available:

Fields

AppReceiverCode
String

Default Value: ""

The name or code of the intended receiver of the transaction set group.

This is an alphanumeric field with a value between 2 and 15 characters.

AppSenderCode
String

Default Value: ""

Code identifying the sender of FunctionalGroup

This is an alphanumeric field with a value between 2 and 15 characters long.

Date
String

Default Value: ""

The date that the group of transaction sets was prepared.

This is a numeric field with a value in the format YYMMDD.

FunctionalIdentifierCode
String

Default Value: ""

A code identifying the type of transaction sets included in the functional group.

This is an alphanumeric field with a code value between of 2 characters.

GroupControlNum
String

Default Value: ""

An identification number assigned by the sender to uniquely identify the group of transaction sets.

This is a numeric field with a value between 1 and 9 digits.

ResponsibleAgencyCode
String

Default Value: ""

A code identifying the issuer of the standard that the transaction set conforms to.

This is an alphanumeric field with a code value of 1 to 2 characters.

Time
String

Default Value: ""

The time that the group of transaction sets was prepared.

This is a numeric field with a value between 4 and 8 digits in the format HHMM, HHMMSS, or HHMMSSDD. Time should be in the 24-hour format.

Version
String

Default Value: ""

Code indicating the version of the X12 standard used to construct the transaction set.

This is an alphanumeric field with a code value between 1 and 12 characters.

Constructors

public X12FunctionalGroup();

X12Interchange Type

An interchange containing functional groups and transaction sets.

Remarks

This type represents an X12 interchange, with fields describing the values from the ISA segment.

The following fields are available:

Fields

AckRequest
String

Default Value: ""

Code indicating whether an interchange acknowledgment is requested.

This is an alphanumeric field with a code value of 1 character, either "0" (no acknowledgment requested) or "1" (acknowledgment requested).

AuthorizationInfo
String

Default Value: ""

Information used for additional identification or authorization of the interchange sender or the data in the interchange.

The type of information is set by the AuthorizationInfoQual field.

AuthorizationInfoQualifier
String

Default Value: ""

A code indicating the type of data supplied in Authorization Information field.

This is an alphanumeric field with a code value of 2 characters.

Date
String

Default Value: ""

The date that the Interchange was prepared.

This is a numeric field with a value of 6 digits in the format YYMMDD.

InterchangeControlNum
String

Default Value: ""

A control number assigned by the sender to uniquely identify the interchange.

This is a numeric field with a value of 9 digits.

InterchangeControlVersionNum
String

Default Value: ""

A code specifying the version of the X12 standard used to construct the Interchange.

This is an alphanumeric field with a code value 5 characters.

ReceiverID
String

Default Value: ""

The identification code of the receiver of the transaction set.

This is an alphanumeric field with a value of 15 characters.

ReceiverIDQualifier
String

Default Value: ""

A code that identifies the format of the receiver ID.

This is an alphanumeric field with a code value of 2 characters.

SecurityInfo
String

Default Value: ""

Coded security information associated with the Interchange.

The type of information is set by the SecurityInfoQualifier.

This is an alphanumeric field with a value between of 10 characters.

SecurityInfoQualifier
String

Default Value: ""

A code indicating the type of data in the Security Information field.

This is an alphanumeric field with a code value of 2 characters.

SenderID
String

Default Value: ""

The identification code of the sender of the transaction set.

This is an alphanumeric field with a value of 15 characters.

SenderIDQualifier
String

Default Value: ""

A code that identifies the format of the sender ID.

This is an alphanumeric field with a code value of 2 characters.

Time
String

Default Value: ""

The time that the Interchange sets was prepared.

This is a numeric field with a value in the format HHMM.

UsageIndicator
String

Default Value: ""

Code to indicate whether the interchange is a test or production.

This is an alphanumeric field with a code value of 1 character.

Constructors

public X12Interchange();

X12TransactionSet Type

An X12 transaction set.

Remarks

This type represents an X12 transaction set, with fields describing the values from the ST segment.

The following fields are available:

Fields

ImpConventionReference
String

Default Value: ""

Reference used to identify the implementation convention.

This is an alphanumeric field with a value up to 35 characters long.

TransactionSetControlNum
String

Default Value: ""

The unique transaction set control number assigned for a transaction set.

This is an alphanumeric field with a value between 4 and 9 characters long.

TransactionSetIDCode
String

Default Value: ""

The identifier code for the transaction set.

This is an alphanumeric field with a code value of 3 characters long.

Constructors

public X12TransactionSet();

X12ValidationErrorDetail Type

Contains the details of a validation error.

Remarks

This represents an error that was encountered while validating an X12 document. The fields contain a description of the error and where in the document it occurred.

The following fields are available:

Fields

Column
int (read-only)

Default Value: 0

The column number where the error occurred.

ComponentIndex
int (read-only)

Default Value: 1

This field holds the position of the component element where the error occurred.

ElementIndex
int (read-only)

Default Value: 1

This field holds the position of the element where the error occurred.

ErrorCode
String (read-only)

Default Value: "0"

The ErrorCode field contains the type of error encountered.

ErrorMessage
String (read-only)

Default Value: ""

ErrorMessage is a textual description of the error.

ErrorType
int (read-only)

Default Value: 0

Indicates the level of the document where the error was encountered. Possible values include:

1Interchange
2Functional group
3Transaction set
4Segment
5Element

FGroupIndex
int (read-only)

Default Value: 1

This field holds the position of the functional group where the error occurred.

InterchangeIndex
int (read-only)

Default Value: 1

This field holds the position of the interchange where the error occurred.

Line
int (read-only)

Default Value: 0

The line number where the error occurred.

Position
long (read-only)

Default Value: 0

This field holds the byte position in the EDI stream where the error occurred.

SegmentIndex
int (read-only)

Default Value: 1

This field is the index of the segment where the error occurred.

SegmentTag
String (read-only)

Default Value: ""

This field specifies the tag name of the segment where the error occurred.

TransactionSetIndex
int (read-only)

Default Value: 1

This field holds the position of the message where the error occurred.

Config Settings (X12Reader Component)

The component accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.

X12Reader Config Settings

InputFormat:   The format of the input document.

This setting controls the type of input document for parsing. Possible values are:

0 (default)X12
1XML
MaxValidationErrors:   The maximum number of validation errors to return.

This setting controls the maximum number of validation errors that will be returned during the validation process. The default value is 200.

Trappable Errors (X12Reader Component)

X12Reader Errors

202   Invalid argument.
304   Cannot write to file.
1003   Could not find the selected schema in the chosen file.
1099   Encountered an unexpected segment tag.
1100   Attempted to perform an action while the component was busy, or close an incomplete interchange.
1044   Tried to load an invalid schema file.
1201   The index is out of range.
1202   The selected ACK type is invalid.
1204   Encountered an error while validating the ISA segment.