Large EDI File Translation by Splitting

Parse large EDI file by splitting EDI transactions

Processing large EDI file where all the data is batched under a single transaction is possible by splitting it into multiple parts. The parser can be configured to split by a repeating loop at any level under the transaction root.

Each part retains the message name (transaction id), the control number and the rest of the base EdiMessage properties of the original. All parts contain the instance of the current split item and all other segments\groups that were previously parsed.

Example

Let's say that you receive purchase orders which sometimes can be very big because they might contain thousands of order lines. You want to split the original purchase order and to produce multiple purchase orders, each of which contains only a single order line. You also want all of the segments and loops that were positioned before the order lines loop to be present in each of the produced purchase orders.

To enable splitting:

Step 1: Edit the EDI Template

First, locate the EDI Template for 850 and locate the TS850 class. Then locate the order lines loop and annotate it with the [Splitter] attribute:

mceclip0.png

Step 2: Enable splitting in the ReaderSettings:

var reader = new X12Reader(edi, "Template", new X12ReaderSettings { Split = true });

This way the following EDI message will be split by the number of occurrences of the PO1 loop, so there will be two parts - the first for the segments in the red square and the second for the segments in the blue squares:

mceclip0.png

The resulting EDI object will contain 2 separate 850 POCOs- one for each PO1 loop:

mceclip2.png

Was this article helpful?
5 out of 7 found this helpful