Scrub EDI Data In File
EDIFileScrubber allows developers to scrub EDI files from the file system using the EDIFile property. EDIFileScrubber will also find the necessary delimiters if set.
Example
// Create a new instance of EDIFileScrubber
EDIFileScrubber scrubber = new EDIFileScrubber
// Set the EDI file path to scrub
scrubber.EDIFile = “C:\EDIFile.txt
// Set the scrubbing rule (s)
// Set element 0,1,2,3 of the ISA segment to be replaced by the character ‘Q’
ScrubRule rule = new ScrubRule();
rule.SegmentName = “ISA”;
rule.ReplaceCharacter = ‘Q’;
rule.ScrubPositions.Add(new ScrubPosition(0));
rule.ScrubPositions.Add(new ScrubPosition(1));
rule.ScrubPositions.Add(new ScrubPosition(2));
rule.ScrubPositions.Add(new ScrubPosition(3));
// Set composite element 0 element 0 of the SVC segment to be replaced by the character ‘W’
ScrubRule rule2 = new ScrubRule();
rule2.SegmentName = “SVC”;
rule2.ReplaceCharacter = ‘W’;
rule2.ScrubPositions.Add(new ScrubPosition(0,0));
scrubber.ScrubRules.Add(rule);
scrubber.ScrubRules.Add(rule2);
// scrub the data
EDILightWeightDocument doc = scrubber.Scrub();