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

How to omit unpopulated segment?

Open MikeCrutchfield opened this issue 2 years ago • 2 comments

I am trying to omit the 'N2' segment from being written out to an 855 Document file. There is no data for the segment but it writes the line anyway.

DTM*068*20230207~
N1*BT*Bill To Name~
N2*~
N3*Bill To Address~
N4*Bill City***US~
N1*ST*Jane Doe~
N2*~
N3*33 South Sixth Street~
N4*Minneapolis*MN*55402*US~
PO1*1*1*EA*32.92**VN*717NV2IC8A~

I have set the Mandatory attribute flag to false and not declared it at all without success.

		[EdiValue(Path = "N2/0", Description = "N201 - Name", Mandatory = false)]
		public string AdditionalName { get; set; }

		[EdiValue(Path = "N2/0", Description = "N201 - Name")]
		public string AdditionalName { get; set; }

Thanks for any help.

MikeCrutchfield avatar Feb 06 '23 15:02 MikeCrutchfield

Hi,

In order to omit the segment from your transmission you have to wrap it in a segment decorated class. After that if the property that holds the N1Segment is set to null the serializer will skip it completely.

C.

cleftheris avatar Feb 06 '23 18:02 cleftheris

Just got a chance to try this. Worked great! Thanks…..Mike

From: Constantinos Leftheris @.> Sent: Monday, February 6, 2023 1:10 PM To: indice-co/EDI.Net @.> Cc: Morris, Michael W. @.>; Author @.> Subject: Re: [indice-co/EDI.Net] How to omit unpopulated segment? (Issue #242)

Hi,

In order to omit the segment from your transmission you have to wrap it in a segment decorated class. After that if the property that holds the N1Segment is set to null the serializer will skip it completely.

C.

— Reply to this email directly, view it on GitHubhttps://github.com/indice-co/EDI.Net/issues/242#issuecomment-1419530621, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A5GJURS5JUFLSSYF6H37G4TWWE46JANCNFSM6AAAAAAUSZLEII. You are receiving this because you authored the thread.Message ID: @.@.>>

MikeCrutchfield avatar Feb 08 '23 15:02 MikeCrutchfield