Skip to main content

core.hl7field.getcomponent

Home > @medplum/core > Hl7Field > getComponent

Hl7Field.getComponent() method

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.

Signature:

getComponent(component: number, subcomponent?: number, repetition?: number): string;

Parameters

ParameterTypeDescription
componentnumberThe component index.
subcomponentnumber(Optional) Optional subcomponent index.
repetitionnumber(Optional) Optional repetition index.

Returns:

string

The string value of the specified component.