Hi, you can call ReadOnlyMessageIterator.createPopulatedSegmentIterator(msg) and use the returned iterator to iterate through the message until you find the desired segment or the iterator is exhausted.
If you know where the segment is located within the message, check if msg.currentReps(segmentName) equals to 0. This call should not create the segment if it does not exist cheers Christian LDH-2 wrote: > > > If i do Msg.getNames(), i get a list of all valid segments for that > message. However, i'd like to have a list only of the segments that were > actually there. The get("SEGMENT") method will create a default segment > if it's not there. > > Is that possible? > > ------------------------------------------------------------------------ > *Laurent (Harry) Hasson* > Co-Founder, 360Fresh.com <https://360Fresh.com> > > This email and any attachments thereto may contain private, > confidential, and privileged material for the sole use of the intended > recipient. Any review, copying, or distribution of this email (or any > attachments thereto) by others is strictly prohibited. If you are not > the intended recipient, please contact the sender immediately and > permanently delete the original and any copies of this email and any > attachments thereto. > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_nov > _______________________________________________ > Hl7api-devel mailing list > Hl7api-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > -- View this message in context: http://old.nabble.com/Testing-if-a-segment-is-actually-in-a-message-tp34659042p34660511.html Sent from the hl7api-devel mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov _______________________________________________ Hl7api-devel mailing list Hl7api-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hl7api-devel