core.hl7segment.setcomponent
Home > @medplum/core > Hl7Segment > setComponent
Hl7Segment.setComponent() method
Sets a component value by field index and component index. This is a shortcut for getField(field).setComponent(component, value)
. Note that both indices are 1-based, not 0-based.
Signature:
setComponent(fieldIndex: number, component: number, value: string, subcomponent?: number, repetition?: number): boolean;
Parameters
Parameter | Type | Description |
---|---|---|
fieldIndex | number | The HL7 field index |
component | number | The component index |
value | string | The new component value |
subcomponent | number | (Optional) Optional subcomponent index |
repetition | number | (Optional) Optional repetition index |
Returns:
boolean
true if the component was set, false otherwise