Question
· Nov 8

EnsLib.HL7.Message.getSegmentByIndex not documented?

Throughout the forum, I find examples of using the method getSegmentByIndex to get the segment as I loop through the HL7 message segments.

Today I spent way too long trying to figure out why I could not modify the segment with this same method. I reached out to my more experienced team and I showed where I got the base code from what I was doing, but I myself could not find the documentation of the method.

After some time, we stumbled upon the GetMutableSegmentAt and GetSegmentAt methods and plugged the mutable method in its place and what do you know, it worked!

What is the purpose of the different methods then for GetSegmentAt and getSegmentByIndex?

Product version: IRIS 2024.1
Discussion (1)2
Log in or sign up to continue

Because it's a method defined with the [ Internal ] keyword, which the class documentation generator excludes. That keyword means that it's not recommended for use by anyone other than InterSystems. Its behavior may change or it may go away, and you're taking a chance by implementing it in your own code.

GetSegmentAt() provides the same functionality but is documented for use by anyone. It's defined in a class (EnsLib.EDI.Segmented) that is inherited by EnsLib.HL7.Message and other virtual document classes.