Setting Minimum And Maximum Lengths

Index

    Setting Minimum And Maximum Lengths

    Creating well-formed EDI documents can mean the difference in an EDI file being accepted or rejected by EDI receivers. EDIDocument helps to make sure that you create well-formed EDI documents.

    It is always good to keep the value in an elements between its minimum and maximum allowable lengths. EDIDocument will do this for you.

    To enable this create a DataElement object using the DataElement(string elementValue, int min, int max) constructor.

    Example

    DataElement element = new DataElement(“A Value”,1,3);
    segment.Elements.Add(element);
     
    or when you add an element to a segment use its overloaded Add method
     
    segment.Elements.Add(“A Value”,1,3);
     
    Now when creating an EDI file  EDIDocument will make sure that the element value conforms to it minimum and maximum requirements by trimming or padding it.
    in Creating Well Formed EDIDocuments
    Did this article answer your question?