EDI.Net icon indicating copy to clipboard operation
EDI.Net copied to clipboard

Optional EdiValue segments in segment group generate empty lines

Open GVG opened this issue 5 years ago • 3 comments

Hello! I have an issue with serializer when defining segments in segment groups like this:

[EdiSegmentGroup(.....)]
public class SG
{
        ...

        [EdiValue("X(100)", Path = "FTX/0")]
        public string Aaa { get; set; }

        public LOC Bbb { get; set; }

        ...
}

Both properties are nulls (they are optional) and they must not be in the EDI document, but I get line FTX+' instead. This can be fixed by moving Aaa to separate segment class similar to Bbb, but it's just excess code in my case. I want to keep those optional single-parameter segments in segment group class. Is this by design?

GVG avatar Feb 26 '20 18:02 GVG

@cleftheris did you check this?

GVG avatar Mar 11 '20 14:03 GVG

Hi @GVG This is not supported at the moment. This could be an improvement in the way compression is handled inside the EdiWriter. The only workaround is the one you mentioned already. That is create a segment class instead.

cleftheris avatar Mar 11 '20 14:03 cleftheris

@cleftheris thanks!

GVG avatar Mar 11 '20 14:03 GVG