Adding Segments to a Message
Segments are a group of fields that can contain varying types of data. Each segment exists independently and can be used in multiple messages.
To add a segment to a message, create a new XML object with a segment code, then add it after the segment it should follow:
var seg = new XML("<ZZZ><ZZZ.1><ZZZ.1.1>My Value</ZZZ.1.1></ZZZ.1></ZZZ>");
msg['QRF'] += seg;
Insert the += operator into a message after a particular segment or at the end of the message. Mirth® Connect has four global functions by which you can create segments for messages:
Function | Function Description | Example |
---|---|---|
Create Segment (individual) | Creates an XML object for the segment that has not been inserted into a message. |
|
Create Segment (in message) | Creates an XML object for the segment at the end of a specified message. |
|
Create Segment (in message, index) | Creates an XML object for the segment in a specified message (msg or tmp) in a specified index and is issued for repeating segments; if a segment is already in the index, the new segment overwrites it. |
|
Create Segment After Segment | Creates an XML object for the segment and adds it after the target segment. |
|
To access these functions, navigate to an Edit Channel page > Channel Tasks panel > Edit Filter or Edit Transformer. On the Reference tab, select the Category bar > Message Functions, among which you will find the Create Segment functions. For additional information, see Reference List.