Question

I have an HL7 Message exporting. There's one field which has a tild symbol (~) in the input. The HL7 is converting that into symbol "\R\"

I also tried exporting this value by using the ASCII value (126) for the '~' character using VBScript as I am . But that was also converted by HL7 to "\R\"

How Can I get the '~' exported ? Any Help would be appreciated.

No correct solution

OTHER TIPS

HL7 escapes the repetition character "~" to "\R\" when transferring a message. The receiver should that change back to your tilde, when working with that field.
But there is a second way to deal with that issue. HL7 allows to change the encoding chars. Unfortunately not all HL7 engines support that.

This character (~) represents that this field can have multiple values. Consider this PID.3 field from a given HL7 message

12345^^^XYZ~6789^^^PQR

What it means that, the patient has 2 patient ids coming from different sources viz. XYZ and PQR. This is what the (~) character means functionally.

If I go by the statement in the question body, I believe you want to achieve the functionality of (~).

To do this, try following below process. I don't know vbscript so I can't give you the code, however I have some Javascript code for the same, and I think you can mimic the same on vbscript. I'll leave that task to you.

 //Calculates number of current repetitions by counting the length
 var pidfieldlen=msg.PID['PID.3'].length();

 //Store the last field node
var lastpidnode=msg['PID']['PID.3'][pidfieldlen-1];    //If length is 5,node index is 4 

 //Create new pid field and append with last pid node 
var newpidfield=<PID.3/>                      //Creating new separate element for PID.3
newpidfield['PID.3.1']="567832"               //Adding Field Values
newpidfield['PID.3.4']="NEW SOURCE"
lastpidnode.appendChild(newpidfield)          //Adding above created to the last node

This will transform the PID.3 into

12345^^^XYZ~6789^^^PQR~567832^^^NEW SOURCE

Try to replace the tilde characters with &#x7e; or &#126; (decimal). See the unicode reference for this character.

If you have already done so, this is not the source of error. I suspect that HL7 attaches a special meaning to this character. According to this webpage it denotes a "Field Repeat Separator".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top