Article: Joining Data – JS

Index

Joining Data

EDIFileJoiner is capable of combining any number of X12 EDI data into one. Data can be combined at either the Interchange (ISA segment), Functional Group Level (GS segment) or at the Header Level (ST segment) by setting the FileJoinLevel property correctly.

It is important to note that the ISA and IEA segments of the first EDI data in the group will be used in the resulting EDI output data whether joining is specified at the functional group or header level.

It is also important to note that the EDIFileJoiner component is powerful enough to join X12 EDI files of different standards (i.e. 837, 834, 820) with completely different delimiter sets. It is recommended that only EDI data of the same standard and having the same delimiter set be combined.

Example

const edi = require(‘rdpcrystal-edi-library’);
 
//First document
let ediDoc1 = “ISA*00*          *00*          *ZZ*133052274      *ZZ*311279999…”;
 
//Second Document
let ediDoc2 = “ISA*00*          *00*          *ZZ*133052274      *ZZ*311279999…”;
 
let documents = [ediDoc1, ediDoc2];
 
let joiner = new edi.EDIFileJoiner();
 
//This these two documents at the functional group (GS) level
joiner.FileJoinLevel = edi.FileJoinLevel.FUNCTIONALGROUP;
 
//Join the two documents
let joinedDocument = joiner.join(documents);
 
console.log(“Joined document by Functional Group”);
console.log(joinedDocument);

Related Articles

Main Categories