Retrieving StartingSegments from 835

Aug 9, 2011 at 2:12 PM

I'm using the interchange model to retrieve various segments from an 835 file, but I can't seem to obtain starting segments. Specifically, I've been trying to obtain elements in the CLP segment of the 2100 loop. The CLP segment is not in the loop's Segments collection, however, as it is never added with the AddSegment method in the Container class; this seems to be true for other segments labeled as StartingSegments in the spec, but I have not verified this. The loop also has a Specification property with a StartingSegment property, but I've been unable to use this either for obtaining the CLP elements.


Thank you for spending time on this great project. Any help with this matter would be very much appreciated.

Aug 9, 2011 at 5:55 PM

Please review this example for extracting information from an 835:

The Interchange model is used directly to create and modify existing files, if you are looking to parse out specific elements, the more natural way to do this is using an xslt.  The example will show you how to create the entire project to do this and it includes the CLP segments in the example.

If this does not solve your problem, please let me know and I can suggest a different solution.  The StartingSegment in the specification is different than in the Interchange model which is why you are getting confused.

Aug 9, 2011 at 11:43 PM

Ah, I didn't realize that the StartingSegments were different and that the Interchange model wasn't meant for reading files - the documentation page for it seems to indicate that it can be used to avoid having to do XML transformations. I really need an object model to work with directly for my particular application, so using XSLT isn't my ideal option. The Interchange model has been working well so far, but I just can't seem to get the segment that immediately follows a loop - it seems strange that the Segments collection contains all of a Loop object's segments except for the first one.

If I'm trying to do something with the Interchange model that simply is not supported, I apologize. Thank you for your help so far.

Aug 10, 2011 at 2:02 AM

Okay, I understand your question better now.  The Loop class inherits from Segment, so your starting segment is actually represented by the Loop object.  You should be able to call GetElement on your Loop class to inspect the starting segment of the loop.

Aug 10, 2011 at 4:20 PM

This resolves my issue - I somehow missed that the Loop class inherits from Segment.

Again, thank you very much for your help.