Getting Validation Errors – JS

Index

    Getting Validation Errors

    Errors generated during validation can be retrieved using the Errors property of EDIValidator. Access the Errors property of the EDIValidator after calling the validate method.

    Example

    validator.validate();
     
    //Get all errors from the EDI data
    for (let i = 0; i < validator.Errors.Count; i++) {
        let error = validator.Errors.getItem(i);
     
        console.log(
            {
                Type: “Error”,
                Line: error.LineNumber,
                Transaction: “”,
                SnipLevel: rules.SnipLevelTypes[error.SnipLevel],  //SnipTestLevel Enum
                Message: rules.MessageTypes[error.Message], //EDIValidationMessage Enum
                Loop: error.Loop,
                Segment: error.Segment,
                Element: error.ElementOrdinal,
                Composite: error.CompositeElementOrdinal,
                Description: error.Description,
                Ordinal: error.SegmentOrdinal
            });
    }

    In addition the EDIError object also contains the corresponding SNIP level for the warning. This level can be accessed through the SnipLevel enum property.

    The possible SNIP levels are:

    • Integrity-Testing for valid EDI syntax for each type of transaction
    • Requirement– Testing for HIPAA specific syntax. This tests that the transaction sets adhere to the HIPAA implementation guides
    • Balance – Testing of the transaction for balanced field totals, financial balancing of claims or remittance advice and balancing of summary fields.
    • Situational – Testing of specific inter-segment situations as defined in the implementation guide, where if A occurs, then B must be populated
    • CodeSet – Testing correct use of external code sets. Tests that only valid values of external data elements are used
    • DoesNotApply – The warning does not have a corresponding SNIP level
    in EDI Validator – JS
    Did this article answer your question?