EdiCompositeDataElement¶
EdiCompositeDataElement represents a composite X12 data element — one whose raw value contains colon-separated sub-elements (BR-019). It is produced when EdiDataElementParser/EdiCompositeDataElementParser detect a colon in an element's raw value and holds a list of child EdiDataElement sub-elements rather than a single scalar value.
Purpose¶
- Models a composite element as an ordered collection of child data elements, each keyed by its sub-element ordinal.
SetChildElement(int, string)adds, updates, or removes a single child by index and immediately re-derives the composite's overallValueby joining all children with a colon and terminating with an asterisk, viaEdiRecordBuilder.BuildCompositeDataElementValue(BR-026); passing anullvalue for an index that already has a child removes that child (BR-024).HasChildrenreports whether the composite currently has any parsed sub-elements, letting callers distinguish an empty composite from one with content.
Context¶
- Namespace:
SAIF.Common.Files.Edi - Assembly/package:
SAIF.Framework.Common.Files - Base class:
EdiElement - Implements:
IEdiCompositeDataElement
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| HasChildren | public bool HasChildren { get; } |
true if this composite currently has one or more parsed child data elements. |
| DataElements | public IEnumerable<IEdiDataElement> DataElements { get; set; } |
The ordered collection of child sub-elements that make up this composite's value. |
| GetElement | public IEdiDataElement GetElement(int index) |
Returns the child sub-element at ordinal index, or null if no child occupies that position. |
| GetChildValue | public string GetChildValue(int elementIndex) |
Returns the raw text value of the child sub-element at elementIndex, or string.Empty if HasChildren is false or no child occupies that position. |
| ToString | public override string ToString() |
Serializes all child sub-elements, colon-joined and asterisk-terminated, via EdiRecordBuilder.BuildCompositeDataElementValue (BR-026). |
| SetChildElement | internal void SetChildElement(int index, string value) |
Adds a new child at index if none exists and value is non-null, removes the existing child at index if value is null (BR-024), or updates the existing child's value otherwise; afterward re-derives Value from the full child list (BR-026). |
| Type | public override ElementType Type { get; } |
Always returns ElementType.CompositeDataElement, identifying this instance as a composite element (BR-019). |
Inherited public members¶
Members in this section are inherited from EdiElement in SAIF.Framework.Common.Files. They are available on this type through inheritance, though Type is overridden above and documented there with its EdiCompositeDataElement-specific behavior.
| Member | Signature | Purpose | Origin |
|---|---|---|---|
| Index | public int Index { get; set; } |
The composite element's ordinal position within its parent segment. | SAIF.Framework.Common.Files — EdiElement |
| Value | public string Value { get; set; } |
The composite's overall colon-joined raw text value. | SAIF.Framework.Common.Files — EdiElement |
| Type | public abstract ElementType Type { get; } |
Identifies the concrete element kind. | SAIF.Framework.Common.Files — EdiElement |
Constraints and usage notes¶
- A composite sub-element can only exist as a child of an
EdiCompositeDataElement; there is no standalone way to model a sub-element outside a composite parent (BR-025).
Sources¶
- Common\SAIF.Common.Files\Edi\EdiCompositeDataElement.cs
- Common\SAIF.Common.Files\Edi\IEdiCompositeDataElement.cs