EnsLib.EDI.X12.Util.Validator

abstract class EnsLib.EDI.X12.Util.Validator

Method Inventory

Parameters

parameter DOMAIN = Ensemble;
Use our own domain for localization

Methods

classmethod CheckCompTR3Rules(pDocType As %String, pCompVal, pSeparator, pOrdinal As %Integer, pCompName As %String, ByRef pErrors, pQuitOnError As %Boolean = 1) as %Boolean [ Language = objectscript ]
Test a component against any situational rules defined for that component. Returns a boolean indicating whether there are any errors

pDocType is the DocType of the document that this segment is in
pCompVal is the data value for the component within an X12 document
pSeparator is the component separator for the document
pOrdinal is the ordinal at which this segment appears within the given DocType
pCompName is the name of the component
pErrors is an array used for tracking any errors we do encounter pQuitOnError is a boolean indicating whether we should stop processing after the first error we find

classmethod CheckDatatype(pValue, pDatatype) as %Boolean [ Language = objectscript ]
classmethod CheckTR3Rules(pDocType As %String, pSegment As EnsLib.EDI.X12.Segment, pOrdinal As %Integer, pSegNum As %Integer = "", ByRef pDataElemErrs="", pQuitOnError As %Boolean = 1, pSegOnly As %Boolean = 0) as %Status [ Language = objectscript ]
Test a segment against any situational rules defined within that segment

pDocType is the DocType of the document that this segment is in
pSegment is the segment being evaluated
pOrdinal is the ordinal at which this segment appears within the given DocType
pSegNum is the position at which this segment appears within the document
pDataElemErrs is an array describing any errors that are found. This is used only for SNIP validation
pQuitOnError is a boolean indicating whether we should stop processing once the first error has been found
pSegOnly is a boolean indicating whether to only check for segment-level rules and skip over situational rules within the composite structures
The returned status code message is used only for flag-style validation.

classmethod EvaluateOneRule(pRule As %String, pValue As %String, pSeparator As %String, Output pIsMissing As %Boolean = 0, Output pExclusion As %Boolean = 0) as %Integer [ Language = objectscript ]
Test a segment or Composite Element against the intra-segment rules defined for that segment or composite

pRule is the code for the rule, as found in the X12 Syntax
pValue is the segment or element value and pSeparator is either the element or component separator, depending on which unit this rule applies to
pIsMissing and pExclusion are booleans to indicate which type of rule violation, if any, we found
The returned value as an integer indicating which element or component the rule violation was found in or 0 if no violation was found.

classmethod Validate(pDoc As EnsLib.EDI.X12.Document, pValSpec As %String = 1, pValidateChildren As %Boolean = 1) as %Status [ Language = objectscript ]
pDoc is the X12 document to validate. pValSpec is a string specifying types of Validation to perform

Set to 1 to block documents that don't pass default validation. Default validation requires a DocType and blocks messages with any other error encountered while mapping the document's sequence of segments using the X12 schema structure specified by the document's DocType. This is equivalent to 'dm'.

All flags relating to fields/components apply only if 's'/'c' also specified (eg. if set to 'dmslt' then the length and datatype of fields will be checked, but the length and datatype of components will not be)

'd' - require DocType
'm' - don't tolerate BuildMap segment mapping errors
's' - enforce segment structures (number and repetition of fields)
'c' - enforce composite structures (number of components)
'r' - enforce required fields/components being present
'u' - enforce non-use of fields/components marked 'Not Used' - Note this is not available when using a new-style only schema
'l' - enforce field/component length restrictions
't' - enforce correct datatypes used for field/component values
'v' - enforce correct code table values used where specified in the schema - Note this is not available when using a new-style only schema
'x' - enforce relational conditions where specified in the schema - Note this is not available when using a new-style only schema
'n' - perform all validation available to new style schemas. This is equivalent to 'dmscrlt'
'a' - perform all available validation. This is equivalent to 'dmscrultv'
'e' - continue validating after errors are encountered - specify this to scan the entire document and report all errors

classmethod ValidateNewComposite(pValue, pSep, pValSpec, pQuitOnError, pStructure, pErrors) as %Boolean [ Language = objectscript ]
classmethod ValidateNewElement(pValue, pValSpec, pInfo, pQuitOnError, pErrors) as %Boolean [ Language = objectscript ]
classmethod ValidateVComposite(pValue, pSep, pValSpec, pQuitOnError, pDocType, pOrdinal, pErrors) as %Boolean [ Language = objectscript ]
classmethod ValidateVElement(pValue, pValSpec, pInfo, pQuitOnError, pDocType, pOrdinal, pErrors) as %Boolean [ Language = objectscript ]
Feedback