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

TedX12Reader

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.
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

property AckType: TedTX12AckTypes read get_AckType write set_AckType;
TedTX12AckTypes = ( at997, at999, atTA1 );

Default Value

at997

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

property BuildDOM: TedTBuildDOMs read get_BuildDOM write set_BuildDOM;
TedTBuildDOMs = ( bdEntireDocument, bdInterchange, bdTranSet, bdNone );

Default Value

bdEntireDocument

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

property Component: TedEDIElement read get_Component;

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

property ComponentCount: Integer read get_ComponentCount;

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

property ComponentIndex: Integer read get_ComponentIndex write set_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

property Delimiters: TedX12Delimiters read get_Delimiters;

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

property Element: TedEDIElement read get_Element;

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

property ElementCount: Integer read get_ElementCount;

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

property ElementIndex: Integer read get_ElementIndex write set_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

property FunctionalGroup: TedX12FunctionalGroup read get_FunctionalGroup;

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

property FunctionalGroupCount: Integer read get_FunctionalGroupCount;

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

property FunctionalGroupIndex: Integer read get_FunctionalGroupIndex write set_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

property InputData: String read get_InputData write set_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

property InputFile: String read get_InputFile write set_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

property Interchange: TedX12Interchange read get_Interchange;

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

property InterchangeCount: Integer read get_InterchangeCount;

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

property InterchangeIndex: Integer read get_InterchangeIndex write set_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

property Loop: String read get_Loop write set_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

property Segment: TedEDISegment read get_Segment;

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

property SegmentCount: Integer read get_SegmentCount;

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

property SegmentIndex: Integer read get_SegmentIndex write set_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

property TransactionSet: TedX12TransactionSet read get_TransactionSet;

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

property TransactionSetCount: Integer read get_TransactionSetCount;

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

property TransactionSetIndex: Integer read get_TransactionSetIndex write set_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

property ValidateOnParse: Boolean read get_ValidateOnParse write set_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

property ValidationErrors: TedX12ValidationErrorDetailList read get_ValidationErrors;

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

function Config(ConfigurationString: String): String;

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

function GenerateAck(): String;

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

function GetElementValue(Path: String): String;

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

procedure LoadSchema(fileOrData: String; messagename: String);

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

procedure 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

procedure 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

procedure SchemaCode(SchemaId: String; CodeListId: String; Value: String; Description: String);

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

procedure SchemaCodeList(SchemaId: String; CodeListId: String; Description: String);

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

procedure SchemaComposite(SchemaId: String; CompositeId: String; Description: String);

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

procedure SchemaElement(SchemaId: String; ElementId: String; DataType: String; MinLength: Integer; MaxLength: Integer; CodeId: String; Description: String);

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

procedure SchemaElementRef(SchemaId: String; ParentId: String; ElementId: String; RefId: String; Required: Boolean; MaxCount: Integer);

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

procedure 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

procedure SchemaGroup(SchemaId: String; GroupPath: String; GroupId: String; Required: Boolean; MaxCount: Integer);

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

procedure SchemaMessage(SchemaId: String; MessageId: String; Description: String);

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

procedure SchemaSegment(SchemaId: String; SegmentId: String; Description: String);

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

procedure SchemaSegmentRef(SchemaId: String; SegmentPath: String; SegmentId: String; Required: Boolean; MaxCount: Integer);

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

procedure SchemaStart(SchemaId: String);

Remarks

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

Validate Method (X12Reader Component)

Validate the EDI document and warn about any errors encountered.

Syntax

procedure 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

type TEndFunctionalGroupEvent = procedure (
  Sender: TObject;
  const Tag: String;
  TransactionCount: Integer;
  const ControlNumber: String
) of Object;

property OnEndFunctionalGroup: TEndFunctionalGroupEvent read FOnEndFunctionalGroup write FOnEndFunctionalGroup;

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

type TEndInterchangeEvent = procedure (
  Sender: TObject;
  const Tag: String;
  GroupCount: Integer;
  const ControlNumber: String
) of Object;

property OnEndInterchange: TEndInterchangeEvent read FOnEndInterchange write FOnEndInterchange;

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

type TEndLoopEvent = procedure (
  Sender: TObject;
  const Name: String;
  Index: Integer
) of Object;

property OnEndLoop: TEndLoopEvent read FOnEndLoop write FOnEndLoop;

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

type TEndTransactionSetEvent = procedure (
  Sender: TObject;
  const Tag: String;
  SegmentCount: Integer;
  const ControlNumber: String
) of Object;

property OnEndTransactionSet: TEndTransactionSetEvent read FOnEndTransactionSet write FOnEndTransactionSet;

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

type TErrorEvent = procedure (
  Sender: TObject;
  ErrorCode: Integer;
  const Description: String
) of Object;

property OnError: TErrorEvent read FOnError write FOnError;

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

type TResolveSchemaEvent = procedure (
  Sender: TObject;
  const VersionNumber: String;
  const TransactionSetIDCode: String
) of Object;

property OnResolveSchema: TResolveSchemaEvent read FOnResolveSchema write FOnResolveSchema;

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

type TSegmentEvent = procedure (
  Sender: TObject;
  const Tag: String;
  const SchemaPath: String;
  Optional: Boolean;
  ElementCount: Integer;
  SchemaIndex: Integer;
  SegmentIndex: Integer;
  MaxCount: Integer;
  const Path: String
) of Object;

property OnSegment: TSegmentEvent read FOnSegment write FOnSegment;

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

type TStartFunctionalGroupEvent = procedure (
  Sender: TObject;
  const Tag: String;
  const AppSenderCode: String;
  const AppReceiverCode: String;
  const DateTime: String;
  const ControlNumber: String
) of Object;

property OnStartFunctionalGroup: TStartFunctionalGroupEvent read FOnStartFunctionalGroup write FOnStartFunctionalGroup;

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

type TStartInterchangeEvent = procedure (
  Sender: TObject;
  const Tag: String;
  const SenderID: String;
  const ReceiverID: String;
  const DateTime: String;
  const ControlNumber: String
) of Object;

property OnStartInterchange: TStartInterchangeEvent read FOnStartInterchange write FOnStartInterchange;

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

type TStartLoopEvent = procedure (
  Sender: TObject;
  const Name: String;
  Index: Integer;
  MaxCount: Integer;
  const Path: String
) of Object;

property OnStartLoop: TStartLoopEvent read FOnStartLoop write FOnStartLoop;

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

type TStartTransactionSetEvent = procedure (
  Sender: TObject;
  const Tag: String;
  const VersionNumber: String;
  const TransactionSetIDCode: String;
  const ControlNumber: String;
  SchemaLoaded: Boolean
) of Object;

property OnStartTransactionSet: TStartTransactionSetEvent read FOnStartTransactionSet write FOnStartTransactionSet;

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

type TValidateWarningEvent = procedure (
  Sender: TObject;
  Position: Int64;
  Line: Integer;
  Column: Integer;
  const ErrorCode: String;
  const ErrorMessage: String;
  ErrorType: Integer
) of Object;

property OnValidateWarning: TValidateWarningEvent read FOnValidateWarning write FOnValidateWarning;

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
Integer (read-only)

Default Value: 0

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

MinLen
Integer (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

constructor Create();

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

constructor Create();

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

constructor Create();

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

constructor Create();

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

constructor Create();

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

constructor Create();

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
Integer (read-only)

Default Value: 0

The column number where the error occurred.

ComponentIndex
Integer (read-only)

Default Value: 1

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

ElementIndex
Integer (read-only)

Default Value: 1

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

ErrorCode
String (read-only)

Default Value: "0"

The ErrorCode property contains the type of error encountered.

ErrorMessage
String (read-only)

Default Value: ""

ErrorMessage is a textual description of the error.

ErrorType
Integer (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
Integer (read-only)

Default Value: 1

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

InterchangeIndex
Integer (read-only)

Default Value: 1

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

Line
Integer (read-only)

Default Value: 0

The line number where the error occurred.

Position
Int64 (read-only)

Default Value: 0

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

SegmentIndex
Integer (read-only)

Default Value: 1

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

SegmentTag
String (read-only)

Default Value: ""

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

TransactionSetIndex
Integer (read-only)

Default Value: 1

This property 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.