Article: Finding Loops – JS

Index

Finding Loops

After an EDILightWeightDocument is initialized by the EDIValidator component, data is stored in a logical structure corresponding to the implementation guides and loops can be retrieved.

Example – Getting a Loop

let doc = ediValidator.EDILightWeightDocument;
 
//Get the Interchange Header loop
let interchange = doc.MainSection.getLoop(“INTERCHANGE HEADER”);

Example – Getting More Than One Loop

//Get all the 2000B loops in ‘parentLoop’
let all2000BLoops = parentLoop.getLoops(“2000B”);

Example – Drilling To Get Loops

//Get all the 2000B loops in loop 2000A of ‘parentLoop’
let all2000BLoops = parentLoop.getLoops(“2000A/2000B”);

Notice the forward slash (‘/’) operator is used to drill into loops.  Use as many forward slashes as required to get to the loop(s) required.

Example

let loop2010AA =
doc.MainSection.getLoop(“INTERCHANGE HEADER/FUNCTIONAL GROUP/ST HEADER/2000A/2010AA”);
 
let all2010AALoops =
doc.MainSection.getLoops(“INTERCHANGE HEADER/FUNCTIONAL GROUP/ST HEADER/2000A/2010AA”);

Related Articles

Main Categories