How to check the SegmentId

Developer
Sep 23, 2011 at 6:33 PM

I'm using the OopFactory in my project and I'm consuming a Loop object and I want to find a certain Segment in his Segments. 

 

acknowledgementCode = "Not Found";
foreach (Segment segment in loop.Segments)
{
	if (segment.SegmentId == "AK5")  //<-Can't really do that because SegmentId is internal in OopFactory.X12
	{
		if (segment.ElementCount < 1)
		{
			//TODO
			//Throw a custom error.
		}
		acknowledgementCode = segment.GetElement((int)TransactionSetResponseHeaderIndex.AcknowledgementCode);
	}
}
 
Is there a better way to find the "AK5" segment I'm looking for?
Coordinator
Sep 24, 2011 at 12:50 AM

You are welcome to change SegmentId to public now that you are a developer on the project.  I had noticed that earlier and never got around to changing it.