core.hl7message.getsegment
Home > @medplum/core > Hl7Message > getSegment
Hl7Message.getSegment() method
Returns an HL7 segment by index or by name.
When using a numeric index, the first segment (usually the MSH header segment) is at index 0.
When using a string index, this method returns the first segment with the specified name.
Signature:
getSegment(index: number | string): Hl7Segment | undefined;
Parameters
Parameter | Type | Description |
---|---|---|
index | number | string | The HL7 segment index or name. |
Returns:
Hl7Segment | undefined
The HL7 segment if found; otherwise, undefined.