web stats
Replace ^ with ¬ in javascript - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-05-2015, 07:59 AM
appsbyaaron's Avatar
appsbyaaron appsbyaaron is offline
Mirth Guru
 
Join Date: Nov 2011
Location: Florida, USA
Posts: 377
appsbyaaron is on a distinguished road
Default Replace ^ with ¬ in javascript

MC 3.0.3.7171

I've got a client that needs the ^ to be ¬ in the messages. I'm using the results from a SQL Server execution.

How do I tell MC to use the ¬ instead of ^ in the segments?

This code should produce:
MSH|¬~\&|SUNNY CORP|SUNNY CORP|SUNNY CORP|ABC|201408200232||DFT¬P03||P¬T|2.2||||||ASCII ||||
PID|0001||55555¬¬¬¬MRN||DOE¬JOHN¬¬¬¬|

Code:
//Build the MSH segment
msg['MSH']['MSH.1'] = "|";
msg['MSH']['MSH.2'] = "¬~\\&";
msg['MSH']['MSH.3'] = "SUNNY CORP";
msg['MSH']['MSH.4'] = "SUNNY CORP";
msg['MSH']['MSH.5'] = "SUNNY CORP";
msg['MSH']['MSH.6'] = "ABC";
msg['MSH']['MSH.7'] = creationDate;
msg['MSH']['MSH.9'] = "DFT¬P03";
msg['MSH']['MSH.10'] = TransactionID;
msg['MSH']['MSH.11'] = "P¬T";
msg['MSH']['MSH.12'] = "2.2";
msg['MSH']['MSH.18'] = "ASCII";


//Build the PID
msg['PID']['PID.1'] = "0001";
msg['PID']['PID.2']['PID.2.1'] = PatientMedicalRecordNumber;
msg['PID']['PID.2']['PID.2.5'] = "MRN";
msg['PID']['PID.5']['PID.5.1'] = PatientLastName;
msg['PID']['PID.5']['PID.5.2'] = PatientFirstName;
msg['PID']['PID.5']['PID.5.3'] = PatientMiddleName

hl7_xml = msg;
temptemp = SerializerFactory.getSerializer('HL7V2').fromXML(msg);

stringToWrite = "\n" + temptemp;

FileUtil.write("/folders/ABC/" + tempFileName, true, stringToWrite);
Reply With Quote
  #2  
Old 03-05-2015, 10:37 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

What you have is basically correct, except that in segments other than MSH.1 and MSH.2, you should be going down to the component level at least. So, do not set MSH.9 equal to "DFT¬P03". Instead, set MSH.9.1 and MSH.9.2 accordingly. The encoding characters (MSH.2) will take care of the rest during deserialization.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 03-05-2015, 12:04 PM
appsbyaaron's Avatar
appsbyaaron appsbyaaron is offline
Mirth Guru
 
Join Date: Nov 2011
Location: Florida, USA
Posts: 377
appsbyaaron is on a distinguished road
Default

Oh fantastic! Thank you!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 11:56 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation