Question
· Feb 13, 2024

Does GetValueAt on an HL7 message have side-effects?

Does the GetValueAt method of an EnsLib.HL7.message object change the contents of the HL7 message?

We want to do two things, given an incoming HL7 message, in our production:

  • transform the HL7 to XML, where the class TNHS.Utils.HL7toXML provides the same methods as, for example, EnsLib.HL7.Util.FormatSimpleXMLv2:
    set sc = message.OutputToLibraryStream(xmlstream,"","","TNHS.Utils.HL7toXML")
     
  • extract a value from a particular field in the message: 
    Set ReportId = message.GetValueAt("PIDgrpgrp(1).ORCgrp(1).ORC:3.1")

If we sequence these as (1) generate XML, (2) extract value using GetValueAt, it works. If we do them in the other order the XML generation fails - produces bad XML (unbalanced elements - no '<PIDgrpgrp>' but lots of '</PIDgrpgrp>' elements). Which suggests that GetValueAt is changing the contents of the HL7 message in some way. Is this right, or is something else going on?

Product version: Caché 2018.1
$ZV: Cache for Windows (x86-64) 2018.1 (Build 184U) Wed Sep 19 2018 09:09:22 EDT
Discussion (3)1
Log in or sign up to continue

Follow-up, as a quick and dirty check, I replaced the call to GetValueAt above with:

set step1 = $PIECE(message.RawContent,"OBR|")
set step2 = $PIECE(part1, "ORC|", *)
set ReportId = $PIECE(part2, "|", 3, 3)

This works before calling the XML generation code when GetValueAt doesn't - so GetValueAt is definitely doing something to the contents of the HL7 message....