Skip to main content

Ens.X12.FunctionSet

class Ens.X12.FunctionSet extends Ens.Rule.FunctionSet

Utility functions for creating X12 Documents

Method Inventory

Methods

classmethod X12BatchErrors(X12Document As EnsLib.EDI.X12.Document, ValidationType As %String = "SNIP", ValidationLevel As %String = 1) as EnsLib.EDI.X12.Document
For X12 batch X12Document, return a new batch containing only those child documents which fail validation as determined by the ValidationType and ValidationLevel specified. The X12Document must have a Document Type set first in order to perform validation. ValidationType can be either SNIP or Flags.
ValidationLevel is either the SNIP level or the validation flags to use.
classmethod X12BatchReply(X12Document As EnsLib.EDI.X12.Document, BatchReplyType As %String = "All", ValidationType As %String = "SNIP", ValidationLevel As %String = 1, BatchErrorAction As %String = "All", LocalApplicationID As %String = "@:@") as EnsLib.EDI.X12.Document
Construct the Reply Interchange containing a 999 or 997 Transaction Set based on validation against pOriginalDoc
The X12Document must have a Document Type set first in order to perform validation. BatchReplyType is string indicating what kind of batch reply should we construct for an Interchange batch we have received Note that all the options here that relate to TA1 segments are used to force a TA1 segment to be generated, often as the only body segment of the reply interchange. This is used to represent the presence or absence of errors in the whole inbound Interchange. However if an error is found in the incoming ISA or IEA that can only be reported in a TA1 segment, then a TA1 will be generated even if the configured setting does not force a TA1 to appear.

- All : Generate a reply Interchange containing a reply notification for every TransactionSet in the Interchange we received
- All+TA1 : Generate a reply Interchange containing a TA1 segment that indicates acceptance or error status for the whole Interchange, and a reply notification for every TransactionSet in the Interchange we received
- All+ISA14TA1 : Generate a reply Interchange containing a TA1 segment only if either a 1 appears in field ISA:14 of the ISA header segment or if there is an error at the Interchange level. If no error at the Interchange level, then send a reply for each Transaction Set we received.
- Errors : Generate a reply Interchange containing reply notifications only for TransactionSets in which errors are detected, or an empty Interchange if no error is found
- OnlyIfErrors : Only if errors are found, generate a reply Interchange containing reply notifications only for TransactionSets in which errors are detected
- Successes : Generate a reply Interchange containing reply notifications only for TransactionSets in which no errors are detected, or an empty Interchange if only errors are found
- TA1 : Generate a reply Interchange containing only a TA1 segment that indicates acceptance or error status for the whole Interchange we received
- OnlyIfErrorTA1 : Only if errors are found, generate a reply Interchange containing only a TA1 segment that indicates error status for the whole Interchange we received
- ISA14-TA1 : Generate a reply Interchange containing only a TA1 segment if a 1 appears in field ISA:14 of the ISA header segment of the incoming Interchange; otherwise return nothing.
- ISA14-OnlyIfErrorTA1 : Only if errors are found and field ISA:14 of the incoming ISA header segment is set to 1, generate a reply Interchange containing only an error TA1 segment; otherwise return nothing.
ValidationType can be either SNIP or Flags.
ValidationLevel is either the SNIP level or the validation flags to use.
BatchErrorAction is a string indicating what to do when detecting a validation error in a batch Interchange document:
- Reject With All Errors : Reject the whole batch if any error is found in any document within it. Enumerate all errors found if BatchReplyType allows for reporting them. This will prevent forwarding any documents in a batch until all have been read and validated.
- Accept With Errors : Accept documents with errors, but do take note of all errors found if BatchReplyType allows for reporting them. This will prevent forwarding any documents in a batch until all have been read and validated.
- Reject On First Error : Reject the whole batch when the first error is found in any document within it. Don't bother checking for more errors or parsing any further contents of the Interchange. This will prevent forwarding any documents in a batch until all have been read and validated.
- Reject Individual Errors : Reject only those documents within the Interchange that have errors. Forward each acceptable child document to the target config item(s) as soon as it has been read and validated.

LocalApplicationID is colon-separated Local ID:Qualifier codes representing this (receiving) facility and application
These are used in constructing reply document headers.
The '@' symbol represents using the corresponding field from the incoming message.
If your ID must contain a literal @ symbol, escape it with backslash: '\@'

classmethod X12BatchSuccesses(X12Document As EnsLib.EDI.X12.Document, ValidationType As %String = "SNIP", ValidationLevel As %String = 1) as EnsLib.EDI.X12.Document
For X12 batch X12Document, return a new batch containing only those child documents which pass validation as determined by the ValidationType and ValidationLevel specified. The X12Document must have a Document Type set first in order to perform validation. ValidationType can be either SNIP or Flags.
ValidationLevel is either the SNIP level or the validation flags to use.
classmethod X12CompleteTrailerAndReturnClear(X12Document As EnsLib.EDI.X12.Document, Save As %Boolean = 0) as %String
For the X12Document the appropriate Trailer segment will be created if it does not exist and the count and control fields assigned based on the contents of the X12Document.
If the optional Save is true (the default is false) then the X12Document will be saved.
The method returns the empty string allowing the unloading of an object via assignment.
If an Error is encountered it will be thrown.
final classmethod X12NewFunctionalGroup(InterchangeParent As EnsLib.EDI.X12.Document, DocType As %String = "", ForceNewPlaceHolderInParent As %Boolean = 0) as EnsLib.EDI.X12.Document
Make and return an X12 FuntionalGroup Document without GE segment
The separators will be taken from the InterchangeParent.
The Document Category will be taken from InterchangeParent unless specified in optional Doctype
The Document Name will be taken from Doctype if given otherwise it will be FunctionalGroup
The optional Doctype may specify just a document name and does not need to include the Document category as that can be taken from the InterchangeParent.
The new document will be set as a batch child of InterchangeParent
The document will have a TransactionSet place holder segment.
If ForceNewPlaceHolderInParent is true (the default is false) then a new GroupDocsRef place holder segment will be made in the InterchangeParent
If an Error is encountered it will be thrown.
final classmethod X12NewTransactionSet(GroupParent As EnsLib.EDI.X12.Document, DocType As %String = "", ForceNewPlaceHolderInParent As %Boolean = 0) as EnsLib.EDI.X12.Document
Make and return an X12 Transaction Set Document without SE segment
The separators will be taken from the GroupParent.
The Document Category will be taken from GroupParent unless specified in Doctype
The Document Name will be taken from Doctype
The Doctype may specify just a document name and does not need to include the Document category as that can be taken from the GroupParent.
The new document will be set as a batch child of GroupParent
If ForceNewPlaceHolderInParent is true (the default is false) then a new TransactionSetDocsRef place holder segment will be made in the GroupParent
If an Error is encountered it will be thrown.
classmethod X12SaveDocumentAndReturnClear(X12Document As EnsLib.EDI.X12.Document) as %String
The X12Document will be saved
The method returns the empty string allowing the unloading of an object via assignment.
If an Error is encountered it will be thrown.
classmethod X12ValidateDocument(X12Document As EnsLib.EDI.X12.Document, ValidationType As %String = "SNIP", ValidationLevel As %String = 1) as %Boolean
Perform validation on X12Document and return true if the document passes validation or false if it fails validation. The X12Document must have a Document Type set first in order to perform validation. ValidationType can be either SNIP or Flags.
ValidationLevel is either the SNIP level or the validation flags to use.

Inherited Members

Inherited Methods

FeedbackOpens in a new tab