Let’s discuss how the EDIValidator component works. EDIValidator is arguably one of the most important components in RDPCrystal EDI Library. It takes two parameters, a validation rules file and an EDI file ( or string ) to validate.
EDIValidator gets all the information it needs from validation rule files. A validation rule file contains all the data elements, segments, and loop meta data pertaining to a specific implementation guide. This information also contains any type of custom validation rules added by developers using the RDPScripting EDI Language. For example, there is a separate rule file for a 5010 837 Professional Health Care EDI file, a separate validation rule file for a 4010 850 Purchase Order, etc. The following image shows a validation rule file opened in the EDI Rules Creator Application.
As can be seen above, validation rule files also contain the structure that EDI data should have. Using validation rules EDIValidator is able to parse and validate EDI data and then create this structure of the EDI data in memory.
Once EDI data is loaded in memory and organized into loops, segments and elements, developers can do whatever they wish with it.
EDILightWeightDocument doc = ediValidator.EDILightWeightDocument;
LightWeightLoop interchangeHeaderLoop = doc.Loops.GetLoop("INTERCHANGE HEADER");
LightWeightSegment isa = interchangeHeaderLoop.GetSegment("ISA");
If Typed Documents are used then getting the EDI data is even easier
X125010Document doc = new X125010Document(ediValidator.EDILightWeightDocument);
EDIValidator also outputs all errors and warnings it encounters while parsing EDI data into its
Errors collection. This data can be displayed to users or used to create 997 or 999 Acknowledgement EDI documents.
The internals of EDI parsing and validation is a relatively complex topic and the RDPScript EDI Language deserves a blog by itself. The important point to remember is that RDPCrystal EDI Library hides all of this complexity and makes working with EDI easy.
Take Charge Of EDI