Checking If EDI File Passed Validation


    Checking If EDI File Passed Validation

    You can check whether an EDI file passed validation by the EDIValidator through the Passed property


    // Create a new instance of EDIValidator
    EDIValidator validator = new EDIValidator();

    // Set the type of EDI file that you are about the validate
    validator.EDIFileType = FileType.X12;
    // Set the source of EDI data, whether you are validating from an in-memory string or a file
    validator.EDISource = EDISource.File // Or EDISource.DataString

    // Set the EDI rules file
    validator.EDIRulesFile= “C:\\EDIFile.Rules”;

    // Set the EDI file to validate
    validator.EDIFile = “C:\\EDIFile.txt”;

    // Validate

    if (validator.Passed)
    // passed
    in EDI Validator
    Did this article answer your question?