This project has moved and is read-only. For the latest updates, please go here.

Generated EDI: How to suppress text-output of unnecessary 278 codes?

Feb 7, 2017 at 7:32 AM
using the default format for outputting X12 data:
var ediInterchange = new X12Interchange(interchangeHeader);

            IEnumerable<string> ediSegments = ediInterchange.GenerateEdi();

            // your EDI message without postfix
            string edi = ediSegments.Aggregate("",
                            (current, segment) => current + segment);

            // your EDI message with new line as postfix
            string ediPostfix = ediSegments.Aggregate("",
                            (current, segment) =>
                                current + segment + Environment.NewLine);
Only problem with this is that it seems that even items marked as "unspecified" -- which is achieved by setting the (e.g.) 2000A.UMO.SomethingSomethingCodeSpecified = false -- are still popping out in the final edi text result. As I debug I see that every single one of these CodeSpecified's in my M_278 object (which I do not want hanging around) are set to false, but their code values still seem arrive in the result. Am I missing something? It does not seem like the .GenerateEdi() does any checking for stuff like this; is it a Schema thing? What am I doing wrong?