qie.escapeHL7¶
Signature: qie.escapeHL7(value, field*, comp*, repeat*, escape*, subComp*)
Returns: String escapedValue - the escaped value
Escape the value for safe use in an HL7 message field.
Note
Segment delimiter CR ('\r') will be escaped as '\X000d\'.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String | value | the value to be escaped | |
| String | field* | (optional) the HL7 field delimiter character | ` |
| String | comp* | (optional) the HL7 field component delimiter character | ^ |
| String | repeat* | (optional) the HL7 field value repeat character | ~ |
| String | escape* | (optional) the HL7 escape character | \ |
| String | subComp* | (optional) the HL7 field sub-component character | & |
Example¶
var hl7Message = qie.parseHL7String("" +
"MSH|^~\\&|SendingApp|SendingFac|ReceivingApp|ReceivingFac|202412051200||ADT^A01|123456|P|2.3\n" +
"PID|1||12345^^^Hospital MRN||Doe^John^A^III||19700101|M|||\n");
var newName = "O'Reilly|Connor^\\Smith&Partners~Doe"; // Value with special characters
hl7Message.setNode('PID-5', qie.escapeHL7(newName));