How can I correctly add the OBXgrp(1).OBX segment to an HL7 message?
Hello,
I'm trying to add another segment to an HL7 MDM message. More specifically OBXgrp(1).OBX. The addition itself works,. When I look at the message in the trace, the segment with the content can be seen. However, it is not displayed as an OBX segment.
Build Map Status = 'ERROR <EnsEDI>ErrMapRequired: Missing required OBXgrp(1) element at segment 6'
'ERROR <EnsEDI>ErrMapSegUnrecog: Unrecognized Segment 6:'' found after segment 5 (TXA)'
.png)
// HL7-Nachricht klonenSet response = msg.%ConstructClone()
// OBX-Segment erstellenSet tSegmentOBX = ##class(EnsLib.HL7.Segment).%New()
Set tSegmentOBX.SegType = "2.7:OBXgrp(1).OBX"
.
.
.
Set tSC = tSegmentOBX.SetValueAt("bla", 3, "set")
.
.
// OBX-Segment an Position 6 einfügenSet tSC = response.InsertSegmentAt(tSegmentOBX, 6)
If$$$ISERR(tSC) {
Return$$$ERROR($$$GeneralError, "Fehler beim Einfügen des OBX-Segments an Position 6.")
}
.
.
.
Set status = ..SendRequestAsync(target, response)
.
.What do I need to change or adjust so that the segment appears correctly in the message?
Many thanks in advance
Comments
I'm pretty sure the SegType property (deprecated, should be using DocType) should be set to just "2.7:OBX".
I found out that I have to set the name of the the segment at "field" zero.
Set tSC = tSegmentOBX.SetValueAt("OBX", 0, "set").png)
Then the segment will be recognized correctly.