core.hl7field | Medplum

Hl7Field class

The Hl7Field class represents one HL7 field. A field is a collection of components.

Signature:

export declare class Hl7Field

Constructors

Constructor Modifiers Description
(constructor)(components, context) Creates a new HL7 field.

Properties

Property Modifiers Type Description
components readonly string[][]
context readonly Hl7Context

Methods

Method Modifiers Description
get(component, subcomponent, repetition) Returns an HL7 component by index.
getComponent(component, subcomponent, repetition) Returns an HL7 component by index. Note that the index is 1-based, not 0-based. For example, to get the first component, use getComponent(1). This aligns with HL7 component names such as MSH.9.2.
parse(text, context) static Parses an HL7 field string into an Hl7Field object.
setComponent(component, value, subcomponent, repetition) Sets a component value at the specified indices. Note that the indices are 1-based, not 0-based.
toString() Returns the HL7 field as a string.