Sidebar

HL7 MSH-2: How do I keeping the "\" in the "^~\&"? Mapping Node

0 votes
156 views
asked Oct 5, 2023 by thanatad-r-3439 (140 points)

Context
I'm building a mapping node.
I'm trying to force it MSH-2 to show "^~\&"

Approach:
Custom script

Snippet

message = qie.createHL7Message('UTF-8');
message.setNode("MSH", "MSH|^~\&|||||||||T|2.3||");
message.setNode("MSH-2", '^~\&');


Result
MSH|^~&|...


1 Answer

+1 vote

The backslash is a special character, so you need to escape it by putting two backslashes next to each other, like this:

message.setNode("MSH", "MSH|^~\\&|||||||||T|2.3||");
answered Oct 5, 2023 by jon-t-7005 (7,590 points)
...