Unescaping a HL7 field in a transform and set to a variable
I need some help with unescaping a value in TXA 2 of an MDM message that I am writing to a variable, to be used in a filename for a PF. Would I use the method Unescape(pData) if so how can I use it in a transform to set the variable? The reason I need to do this is I need to use the name as file name when writing the PDF to a directory. The escape characters and invalid for file names .
Hi John,
If I understood, you want to pass the code to a method and return the description.
All descriptions of HL7 code tables are stored in the global ^EnsHL7.Description.
The structure of global is ^EnsHL7.Description(<category>,"CT",<codeTableCode,valurKey>)=<descritpion>.
For HL7 Schema Category 2.3.1 the global have the content:
A generic method would be like:
I am not looking to get the description I am looking to Un-escape the value out of TXA 2.2. Epic is escaping the TXA 2.2 value in the message from H&P to H\T\P. I am already pulling TXA 2.2 and storing it , problem in I need original value.
Sorry my misunderstood John.
The class EnsLib.HL7.Segment has methods Escape and Unescape and classmethods EscapeEx and UnescapeEx.
See documentation about HL7 Escape Sequences.
Example:
how do you use the Unescape in a Transformation?
Would a <code> section work?
How do you pass the source and return something useful to use in the transform?
I got a note comment that has escape sequence in it.
Thank you
A <code> section would work, but if you're going to use this regularly within your DTLs, it might make sense to create a custom method that would be available through the Function drop-down list in the DTL Editor. For Example:
Class User.Test.FunctionSet Extends Ens.Util.FunctionSet { /// Unescapes the field value provided in <var>pPath</var> and returns it as a String. ClassMethod UnEscapeHL7(pPath As %String, pSeps As %String = "|^~\&", pEsc As %String = "\") As %String { Return ##class(EnsLib.HL7.Segment).UnescapeEx(pPath, pSeps, pEsc) } }
Call it like this (replacing the field in my example with the field containing your note comment):
I've updated the method to optionally accept separators and the escape character as arguments; you would use source.Separators and source.ESC to override the default values with the ones supplied in the source message.