web stats
Mirth Community - View Single Post - Run Javascript in Channel Context Outside of Mirth
View Single Post
  #6  
Old 06-18-2019, 07:58 PM
Jeff Drumm Jeff Drumm is offline
Mirth Newb
 
Join Date: Jun 2019
Posts: 23
Jeff Drumm is on a distinguished road
Default

Quote:
Originally Posted by agermano View Post
Also, the SerializerFactory from the User API doesn't work outside of mirth because it checks with the controllers to see which data types are currently registered.

You can still build them yourself, though.

Code:
var deserializationProperties = new com.mirth.connect.plugins.datatypes.hl7v2.HL7v2DeserializationProperties();
var serializationProperties = new com.mirth.connect.plugins.datatypes.hl7v2.HL7v2SerializationProperties();
var serializerProperties = new com.mirth.connect.model.datatype.SerializerProperties(serializationProperties,deserializationProperties,null);
var ser = new com.mirth.connect.plugins.datatypes.hl7v2.ER7Serializer(serializerProperties);
var msg = new XML(ser.toXML('DG1|1||250.00^^I9'));
msg.DG1['DG1.1']['DG1.1.1'] = 2;
var encoded = ser.fromXML(msg.toXMLString());
// DG1|2||250.00^^I9

Ahh, good stuff. We need a "like" button
Reply With Quote