Load EDI Data From File

Index

    Load EDI Data From File

    EDIFileLoader allows developers to load EDI files from the file system using the EDIFile property. EDIFileLoader will also find the necessary delimiters if set.

    Example

    // Create a new instance of EDIFileLoader
    EDIFileLoader loader = new EDIFileLoader();

    loader.AutoDetectDelimiters = true;

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

    // Set the EDI file path to load
    loader.EDIFile = “C:\\EDIFile.txt;

    // load the data
    EDILightWeightDocument loadedDocument = loader.Load();

    Since there are no rules required EDIFileLoader only parses and loads all the segments in one loop. It does not group the segments into a loop hierarchy structure. In order to retrieve the segments just access the Loops property with index 0. The segments are of type LightWeightSegment. They contain their corresponding elements and composite elements.

    in EDI File Loader
    Did this article answer your question?