Using Mirth 3.9
I am very new to Mirth. I am transforming flat files to HL7. The notes column of the flat file occasionally has a backspace(note). backspace = hex 08. My transformation is on the Source. My code to remove the backspace isn't working.
if (row['NTE'].toString() != "")
{
var nte = <NTE/>;
x++
nte['NTE.1'] = x;
nte['NTE.3']['NTE.3.1'] = row['NTE'].toString().replace(/\x08/g,'');
tmp.appendChild(nte);
}
}
}
Here is the error
Transformer error
ERROR MESSAGE: Error evaluating transformer
com.mirth.connect.server.MirthJavascriptTransforme rException:
CHANNEL: OTTR Lab_99334307
CONNECTOR: sourceConnector
SCRIPT SOURCE:
SOURCE CODE:
94: }
95: eval('importPackage(' + Packages.java.lang.Class.forName(className).getPac kage().getName() + ')');
96: }
97: }
98: function doScript() {
99: msg = new XML(connectorMessage.getTransformedData());
100: if (msg.namespace('') != undefined) { default xml namespace = msg.namespace(''); } else { default xml namespace = ''; }
101: tmp = new XML(template);
102: function doFilter() { phase[0] = 'filter'; return true; }function doTransform() { phase[0] = 'transformer'; logger = Packages.org.apache.log4j.Logger.getLogger(phase[0]);
103:
LINE NUMBER: 99
DETAILS: TypeError: An invalid XML character (Unicode: 0x8) was found in the element content of the document.
at ae7350d8-2700-4263-bfe6-5402f38e76b6:99 (doScript)
at ae7350d8-2700-4263-bfe6-5402f38e76b6:180
at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.doCall(JavaS criptFilterTransformer.java:154)
at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.doCall(JavaS criptFilterTransformer.java:119)
at com.mirth.connect.server.util.javascript.JavaScrip tTask.call(JavaScriptTask.java:113)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source)
On another post I found to add to the preprocessor
var newMessage = message.replace(/[\x00-\x08]|[\x0B-\x0C]|[\x0E-\x1F]/g, '');
I've never worked with the preprocessor. When I added this to the preprocessor I still get the error above.
I am very new to Mirth. I am transforming flat files to HL7. The notes column of the flat file occasionally has a backspace(note). backspace = hex 08. My transformation is on the Source. My code to remove the backspace isn't working.
if (row['NTE'].toString() != "")
{
var nte = <NTE/>;
x++
nte['NTE.1'] = x;
nte['NTE.3']['NTE.3.1'] = row['NTE'].toString().replace(/\x08/g,'');
tmp.appendChild(nte);
}
}
}
Here is the error
Transformer error
ERROR MESSAGE: Error evaluating transformer
com.mirth.connect.server.MirthJavascriptTransforme rException:
CHANNEL: OTTR Lab_99334307
CONNECTOR: sourceConnector
SCRIPT SOURCE:
SOURCE CODE:
94: }
95: eval('importPackage(' + Packages.java.lang.Class.forName(className).getPac kage().getName() + ')');
96: }
97: }
98: function doScript() {
99: msg = new XML(connectorMessage.getTransformedData());
100: if (msg.namespace('') != undefined) { default xml namespace = msg.namespace(''); } else { default xml namespace = ''; }
101: tmp = new XML(template);
102: function doFilter() { phase[0] = 'filter'; return true; }function doTransform() { phase[0] = 'transformer'; logger = Packages.org.apache.log4j.Logger.getLogger(phase[0]);
103:
LINE NUMBER: 99
DETAILS: TypeError: An invalid XML character (Unicode: 0x8) was found in the element content of the document.
at ae7350d8-2700-4263-bfe6-5402f38e76b6:99 (doScript)
at ae7350d8-2700-4263-bfe6-5402f38e76b6:180
at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.doCall(JavaS criptFilterTransformer.java:154)
at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.doCall(JavaS criptFilterTransformer.java:119)
at com.mirth.connect.server.util.javascript.JavaScrip tTask.call(JavaScriptTask.java:113)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source)
On another post I found to add to the preprocessor
var newMessage = message.replace(/[\x00-\x08]|[\x0B-\x0C]|[\x0E-\x1F]/g, '');
I've never worked with the preprocessor. When I added this to the preprocessor I still get the error above.
Comment