Skip to main content

core.hl7message.setsegment

Home > @medplum/core > Hl7Message > setSegment

Hl7Message.setSegment() method

Sets or replaces a segment at the specified index. Only allows MSH header to be replaced as first segment. If index is a number and is larger than the length of the segments array, it will be appended as the last segment. If the index is a string, replaces the first segment with that name.

Signature:

setSegment(index: number | string, segment: Hl7Segment): boolean;

Parameters

Parameter

Type

Description

index

number | string

The segment index or name

segment

Hl7Segment

The new segment to set

Returns:

boolean

true if the segment was set, false otherwise