web stats
Mirth Community - View Single Post - Assigning Arbitrary Empty XML Node
View Single Post
Old 04-18-2019, 09:07 AM
ace ace is offline
Mirth Newb
Join Date: May 2016
Location: Austin, TX, USA
Posts: 9
ace is on a distinguished road
Default Assigning Arbitrary Empty XML Node

Is it possible to create an arbitrary empty/blank XML node to assign to the arrays that Connect uses to represent HL7?

For example, I can hardcode a statement like this which replaces the MSH:

var msgXML = new XML(SerializerFactory.getSerializer('HL7V2').toXML (inStr));
msgXML['PID']['PID.5'] = <PID.5/>;

But, the <PID.5/> seems like it is a special variable or constant in Connect, not a String, so is there a way to have a variable that contains the
name of an HL7 field, like the String, 'MSH.10', or in the case above, 'PID.5', and by using that String variable, dynamically assign
an empty node, as I have done in the hardcoded version? Perhaps something like this:

var hl7FieldName = 'PID.5';
var emptyXmlNode = magicMysteryFunction(hl7FieldName);
msgXML['PID']['PID.5'] = emptyXmlNode;
Reply With Quote