Recent posts:
Recent replies:

I ended up opening a WRC for this. We were able to resolve this by utilizing Enslib.HL7.Message's OutputToString and ImportFromString methods to just store the entire contents in a string that could then be manipulated directly.

Including the entire method here, in case someone else stumbles upon this and needs it:

ClassMethod Transform(pRequest As EnsLib.HL7.Message, Output pResponse As EnsLib.HL7.Message) As %Status
// Get the MSH values for logging purposes
set MSHID = pRequest.GetValueAt("MSH:10")
set MSHDT = pRequest.GetValueAt("MSH:7") // Save the whole HL7 message into a string so we can manipulate it
  set data = pRequest.OutputToString()
  // Loop through the string, replacing Non-ASCII characters with spaces until you don't find any more
set tEnd = 1
Set tLocation = $LOCATE(data,"[^\x09-\x0d\x20-\x7e]",,tEnd)
While tLocation {
set ^ASCIIStrip($NOW(),$INCREMENT(i))="Non-ASCII Character Found at Position " _ (tEnd-1) _ " in Msg ID " _ MSHID _ " with MSH Date " _ MSHDT
// replace with a space
Set $EXTRACT(data,tLocation,(tEnd-1)) = " "
Set tEnd = 1
Set tLocation = $LOCATE(data,"[^\x09-\x0d\x20-\x7e]",,tEnd)
} // Save that modified string back into an HL7 message
set pResponse = pResponse.ImportFromString(data) // Manually set the DocType and MessageTypeCategory from the source
set tSC = pResponse.PokeDocType(pRequest.DocType)
set tSC = pResponse.PokeTypeCategory(pRequest.MessageTypeCategory) Quit 1

Thanks, that does help, but I still have the problem of figuring out how to address the entirety of the message. There is a RawContent property, but it's truncated.

Adam has no followers yet.
Adam has not followed anybody yet.
Global Masters badges:
Adam has no Global Masters badges yet.