Index
Finding Segments
Once a TypedDocument is created Typed Segments can be retrieved. Data is stored in a logical structure corresponding to the implementation guides.
Example – Getting a Segment
Typed5010Document doc = newTyped5010Document(ediValidator.EDILightWeightDocument);
DocumentLoop interchange = doc.MainSection.GetLoop(“INTERCHANGE HEADER”);
//Get ISA segment
ISA isa = interchange.GetSegment<ISA>();
Example – Getting More Than One Segment of the Same Type
//Get all the REF segments in this loop
List<REF> refSegments = loop.GetSegments<REF>(“REF”);
foreach (REF segment in refSegments){
}
Example – Drilling To Find Segments
//Get all the REF segments in the 2010BA loop. Loop 2010BA is a child of ‘parentLoop’
List<REF> refSegments = parentLoop.GetSegments<REF>(“2010BA/REF”);
foreach (REF segment in refSegments){
}
Notice the forward slash (‘/’) operator is used to drill into loops. Use as many forward slashes as required to get to the segment(s) required.
Example
NM1 nm1 =
doc.MainSection.GetSegment<NM1>(“INTERCHANGE HEADER/FUNCTIONAL GROUP/ST HEADER/2000A/2010AA
/NM1″);
List<REF> refSegments =
doc.MainSection.GetSegments<REF>(“INTERCHANGE HEADER/FUNCTIONAL GROUP/ST HEADER/2000A/2010AA
/REF”);