N4Segment¶
N4Segment models the X12 N4 party geographic-location segment, used after N1Segment/N3Segment in 837/835 transactions to carry a party's city, state, and postal code. On Fill(), a postal code longer than five characters is split into a five-digit ZipCode and a ZipCodeExtension, and the two are concatenated back together on Build() (BR-049).
Purpose¶
- Represents the N4 segment identity via
SegmentIdreturning the literal"N4"(BR-020). - Carries
CityNameandStateCode, the party's city and state. - Splits a postal code longer than five characters at parse time into
ZipCode(first five characters) andZipCodeExtension(the remainder), and rejoins them into a single element value onBuild()(BR-049).
Context¶
- Namespace:
SAIF.Common.Files.Edi.Segments - Assembly/package:
SAIF.Framework.Common.Files
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| SegmentId | string SegmentId { get; } |
Returns the literal X12 segment identifier "N4". |
| CityName | string CityName { get; set; } |
The party's city name (N401), element 1. |
| StateCode | string StateCode { get; set; } |
The party's state or province code (N402), element 2. |
| ZipCode | string ZipCode { get; set; } |
The first five characters of the postal code (N403 positions 1-5) (BR-049). |
| ZipCodeExtension | string ZipCodeExtension { get; set; } |
The remaining characters of the postal code beyond the first five (N403 positions 6-9), set only when the original value exceeds five characters (BR-049). |
| Build | IEdiSegment Build() |
Creates a SegmentBuilder("N4") and adds CityName, StateCode, and the concatenation ZipCode + ZipCodeExtension at elements 1-3, returning the built segment (BR-049). |
| Fill | void Fill(IEdiSegment segment) |
Reads elements 1-2 into CityName/StateCode; for element 3, if the value's length exceeds 5 splits it into ZipCode (first 5 chars) and ZipCodeExtension (remainder), otherwise assigns the whole value to ZipCode (BR-049). |
| Parse | static N4Segment Parse(IEdiSegment segment) |
Instantiates a new N4Segment, calls Fill(segment) on it, and returns it. |
Sources¶
- Common\SAIF.Common.Files\Edi\Segments\N4Segment.cs