RTF replace string logic corrupting document for viewer
I have an MDM interface with a DTL that takes OBX:5 and replaces "{\E\rtf" with "{\rtf" and "\X0A\" with nothing. Most rtf's this works without a problem, some others, it corrupts the document.
Code:
<assign value='..ReplaceStr(..ReplaceStr(source.{OBXgrp(k1).OBX:ObservationValue(1)},"{\E\rtf","{\rtf"),"\X0A\","")' property='target.{OBXgrp(k1).OBX:ObservationValue(1)}' disabled = '0' action='set' />
My question is - anyone know of any other "gotchas" that could possibly need to be replaced or something?
I have tried not doing the replace on anything, and the document shows up in viewer as just the rtf code rather a human readable document. I am at a loss, any direction would be wonderful.
Thanks!
Comments
The values you are trying to replace are HL7 escape characters, so I would start with swapping your nested ReplaceStr()'s with:
##class(EnsLib.HL7.Segment).Unescape(source.{OBXgrp(k1).OBX:ObservationValue(1))So it looks like:
.png)
More info can be found here: https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=EHL72_escape_sequences